How do I set up a delay within a command block

I’m trying to recreate Runner in Minecraft 1.9 singleplayer, but I cannot get how to set up a delay so that the player can run without getting killed.

  • Can mobs drop special items?
  • How do I get the Ender Dragon egg and what does it do?
  • How can I see the list of connected players?
  • Is the .minecraft folder hidden on a Mac?
  • What is the bee genetic heirarchy?
  • Is it possible to change the linkage of Nether portals?
  • How do you stop yourself dying while drowning?
  • How do I keep Endermen out of my mushroom farm?
  • What can I do to secure my towns/castles/hovels from climbing spiders?
  • What happened to my minecraft world?
  • How can I host my own Minecraft server?
  • How can I start a minecraft server from the web?
  • 2 Solutions collect form web for “How do I set up a delay within a command block”

    Add an scoreboard objective:
    /scoreboard objectives add Moving stat.walkOneCm

    Run the following commands in a clock(in exactly that order):

    /kill @a[score_Moving=0,m=!1]
    /scoreboard players set @a Moving 0

    Be careful when setting this up.
    You will get killed, when not walking/running.
    And when the machine is killing you the whole time, you have no chance to disable it(except for external tools).

    I think what you want is a “grace period” for not running? I.e. the command blocks kill you if you stand still for more than, say, a second?

    If so, you can run these in a repeat/chain setup:

    /scoreboard players set @a OnGround 0 {OnGround:0b}
    /scoreboard players set @a OnGround 1 {OnGround:1b}
    /scoreboard players remove @a[score_Moving_min=1] Moving 1
    /scoreboard players set @a[score_Moving_min=20] Moving 20
    /kill @a[score_Moving=0,score_OnGround_min=1,tag=Running]
    /scoreboard players tag @a[score_Moving=0,score_OnGround_min=1,tag=Running] remove Running

    Moving is a stat.walkOneCm type objective, the OnGround tag is dummy. Moving does not increase while jumping/falling, which makes this addition necessary or else jumping or falling could kill you. The Running tag is to prevent an endless kill loop, add it to anyone that has to run to not die.

    To adjust the timing, adjust the score set in the second command (both in the target selector and the set command) to the number of ticks the player may stand still (20 ticks = 1 second). This command acts like a “hard cap” on the Moving score (it can never exceed the value given).

    We love Playing Games, especially Video Games.