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

How would i detect when a Humanoid is Idle, Walking, Jumping etc?

I am trying to make my own animation script for my custom animated NPCs, but i cannot figure out how to detect when the NPC is performing an action such as standing Idle or Walking, i have tried multiple functions for Humanoid but i cannot figure out what to do?

1 comment

1 answer

✓ Accepted answer

You can used the Changed event to detect jumping and walking. I guess you can detect if they are idle if the idle animation is playing, but i dont know how to do that. Lets go to the script. Put the script in StarterGui.

local plr = game.Players.LocalPlayer.Character
local debounce = false
local debounce2 = false
plr.Humanoid.Changed:connect(function(prop) --I just said prop instead of property.
	if prop == 'Jump' and not debounce then
		debounce = not debounce
		print(plr.Name..' has jumped!')
		wait()
		debounce = not debounce
	end
end)

plr.Head.Changed:connect(function(prop)
	if prop == 'Position' and not debounce2 then
		debounce2 = not debounce2
		print(plr.Name..' is walking!')
		wait(1)
		debounce2 = not debounce2
	end
end
		

		

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