Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I check if player is moving?

I am using a custom character for my game, so things may be different, I am still using a Humanoid and everything else needed in a character, but I do not have an animation script.

So, I need to figure out how I can detect when the Player is moving at a certain WalkSpeed, and I cant seem to figure it out. This is what I tried.

humanoid.Running:connect(function(speed)
	if speed > 10 and speed < 16 then
		print("Running")
	end
end)

1 comment

0

http://wiki.roblox.com/index.php?title=API:Vector3#Magnitude <Just a guess, but have you tried that? Part.Velocity.Magnitude

1 answer

✓ Accepted answer

This should work if you have declared your humanoid the correct way.

However, you are saying if speed is > 10 and < 16. The standard walkspeed of a player is 16, but this will only print if they are 11-15 consider changing to this

humanoid.Running:connect(function(speed)
    if speed >= 10 and speed <= 16 then
        print("Running")
    else 
	print('stopped Running') 
    end
end)

3 comments

0

hmm, still not working, does humanoid.Running require the animation script or something? I dont use an animation script in my character.

0

hmm, i dont think so, i believe it just takes the walkspeed of the humanoid. Are you getting any errors? also, is there more to the script, like where you declare your variables like 'humanoid'?

0

Yes, I declare "humanoid" with script.Parent.Humanoid(the script is in the character). I am not having any error messages. Maybe with custom characters it doesn't work. I tested it if it is running at all, it prints "Running", and that works, but just checking for speeds doesn't work. Maybe I should just try and check the humanoid.WalkSpeed with a Running event.

This discussion is preserved as it was. New answers, comments, and votes are closed.