I am making another map and the theme is that the player must keep moving at all times. How would I test if a player is moving? I think you can do it with scoreboard, but I'm not sure. Please help me.


The first thing you want to do is to create a scoreboard objective

/scoreboard objectives add Walking stat.walkOneCm Walking

You can show it on the side bar by using this command:

/scoreboard objectives setdisplay sidebar Walking

Do these next steps on a 20Hz fill clock:

You want to set the score of a player to 15 if it goes higher...

/execute @p[score_Walking_min=15] ~ ~ ~ /scoreboard players set @p Walking 10

Then take away 5 from the score every 20 ticks.

/scoreboard players remove @p Walking 5

If they stop moving the score will reach 0 very soon.

So you want to test if a player has a score of 0

/testfor @p[score_Walking_min=-100,score_Walking=0]

Feed that into a comparator and if the score goes below zero it will switch on...

Do whatever you want at that point!

Not the answer you're looking for? Browse other questions tagged or ask your own question.