Humanoid:GetState() not working for some reason?
So I was making my own chat system that if the player typed /e dance the player would play an animation. I also made some events to check if the player was moving. I did try to search but it still doesn't work.
This is the script:
01 | game.ReplicatedStorage.ChatMessage.OnServerEvent:Connect( function (p, msg) |
02 | if msg ~ = "/e dance" then |
05 | local char = p.Character |
06 | local hum = char.Humanoid |
07 | local anim = char.Animations.Dance |
08 | local track = hum:LoadAnimation(anim) |
09 | if hum:GetState() = = Enum.HumanoidStateType.None then |
13 | hum.Jumping:Connect( function (jump) |
19 | hum.Died:Connect( function () |
23 | hum.FreeFalling:Connect( function (fall) |
29 | hum.StateChanged:Connect( function (state) |
30 | if state = = Enum.HumanoidStateType.Landed then |
35 | hum.StateChanged:Connect( function (state) |
36 | if state = = Enum.HumanoidStateType.Freefall then |
42 | hum.StateChanged:Connect( function (old, new) |
43 | if old = = Enum.HumanoidStateType.Climbing then |
45 | elseif new = = Enum.HumanoidStateType.Climbing then |
50 | hum.Running:Connect( function (spd) |
56 | hum.Seated:Connect( function (sit) |