I’m trying to play certain animations when the player hasn’t been doing anything for about a minute,
but I can’t find a proper way to detect this player behaviour.
There doesn’t seem to be any statetype that fires an event for this either, so that makes things more complicated.
Is there perhaps any other method to do this, or will I need to make a workaround?
I do not believe there is an event for this, I do know that the BasePart class offers a Velocity argument. If you do a while loop and constantly check this variable, perhaps you can play the animation that way.
For example, this could work:
while true do
if player.Character.Torso.Velocity < 5 then
-- play animation
end
wait()
end
I didn’t know that, thanks! That might just turn out to be useful.
While that is a possible fix, I’d rather not have a while loop run most of the time.
However, checking for the player’s velocity is also a good one to consider. Thanks!
I mean you could always use the GetPropertyChangedSignal event on your part for the velocity like so. You can even do that with Smellysuperfart’s answer.
player.Character.Torso:GetPropertyChangedSignal('Velocity'):Connect(function()
if player.Character.Torso.Velocity < 5 then
-- play animation
end
end)
Unfortunately that would not work on mobile and Xbox because you can walk less than 5 studs per second due to the sensitivity of the joystick. So I would say the best method is to check the MoveDirection.