How would i make a Script that if Player doesnt move play (insert) animation

So right now i have a problem that if my Sprint Script is used

It sometimes bugs and plays my Double W Animation (Sprint)

https://gyazo.com/2ee195e9b30a8e4c6bd534b13013312c

I cant seem to fix it since i have barely any Information on that,
As a Solution i thought that the following idea would fix that.

If a Player doesnt move for lets say 0.5 Seconds then play IdleAnim.
However i dont know how i would make such a script.
Thats why i came here for help (:

Appreciate any kind of help !
best regards AurumWrl

1 Like
game:GetService("RunService").Heartbeat:Connect(function()
  if humanoid.Magnitude <= 0 then
    --play animation
  end
end)

Thanks for the help ill try it out in a minute :smiley:

Alright so humanoid is unknown and i cant get playAnimation() into --play animation :confused: any ideas?

look into this instance called an animator object and play it client side

1 Like