How to make animation play when a player is moving and the animation will stop when they stopped moving
✓ ANSWER ACCEPTED
How to make an animation play when a player is walking/running?
1 answer
✓ Accepted answer
You can do HumanoidStateType. Or you can check for velocity. I have omitted the scripts that play the animation, because I am a lil lazy and it seems you already know how to do that. In a localscript, in the character model of each player (put script in starter character scripts)
while true do
local vel = script.Parent.HumanoidRootPart.Velocity
local speed = ((vel.X)^2 + (vel.Z)^2) ^(0.5)
if speed >= 16 then
-- Play Run Anim Script
else if speed <16 and speed >= 0. 1 then
-- Play Walk Anim Script
else
-- Play Idle Anim Script
end
end
end
wait()
end
Mark as answer if this solves your question. If this isn't what you intended, comment on this an I will get back to you ASAP.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You can use the humanoid state https://developer.roblox.com/en-us/api-reference/enum/HumanoidStateType