How to tell when a player isn't moving?

How to tell when a player isn't moving? - Selective Focus Photography of Man Holding Nike Football Ball

Is there a away to test if a player isn't moving?

At the moment I have put this command on a hopper clock:

/scoreboard players set @a sneak 3 

But that doesn't seem to work because in another command block I am testing for a score of three, and every tick it summons a block even when you're moving.

I am using this for a vanilla block hunt so when your not moving you become a solid block.



Best Answer

@132ikl's answer works in general, but there is a flaw to the design: stat.walkOneCm does not increase while you are in mid-air. We can fix this by assuming every player that is in mid-air is moving.

Create the scoreboard:

/scoreboard objectives add Moving stat.walkOneCm

Create a 20Hz clock or use repeat/chain command blocks and run the following two commands:

/scoreboard players remove @a[score_Moving_min=1] Moving 1 {OnGround:1b}
/scoreboard players set @a[score_Moving_min=1] Moving 1

The first command will reduce the Moving score by one for every player on the ground, if it is at least 1 (I.e. the score will not go below 0).
The second command limits the Moving score to at most 1 by setting it to one if it is greater.

Moving will be 1 for people that are moving, or were moving prior to jumping (jumping in place does not work), and 0 otherwise.




Pictures about "How to tell when a player isn't moving?"

How to tell when a player isn't moving? - Man in White T-Shirt and Black and White Pants Playing Golf
How to tell when a player isn't moving? - Man in White T-Shirt Playing Golf
How to tell when a player isn't moving? - Boy in White and Blue Plaid Button Up Shirt



How can you tell if a player is running on Roblox?

You can just check if they're holding the shift key, or if that's not an option check the players walk speed. then you can alter what it does (like particles) when its pressed! You can use Humanoid:GetState in order to see if the player's current state is either Enum.

How can you tell if a player is walking on Roblox?

The title pretty much explains it. I couldn't find anything on devforum or youtube. The Humanoid has a property called MoveDirection which determines, as a unit vector, the direction a player is moving in. You can access the Magnitude property and see if it's greater than 0 to know if there is active movement.

How do you check if a player is still touching a part?

find(part:GetTouchingParts(), v). If the table. find returns true, then the player is touching the part. That's when your part's size doesn't matter, what if the part's way too long?



How To Spot A Player | 10 DEAD Giveaways The Guy Is A Player




More answers regarding how to tell when a player isn't moving?

Answer 2

Step 1: Create two scoreboards:

/scoreboard objectives add walk stat.walkOneCm  
/scoreboard objectives add moving dummy

Step 2: Make a command block clock with these commands:

/scoreboard players set @a walk 0
/scoreboard players set @a[score_walk_min=1] moving 1

Then everyone that is not walking will have a moving score of 0

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Pixabay, cottonbro, cottonbro, Vlada Karpovich