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?
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