Hello, I am practising using the StateChanged
event of Humanoid instead of the old Running
and Jumping
events. I have got the running and jumping working, but whenever I stop running, the StateChanged event doesn't fire and my 2D morph is left running on the spot. The jumping state changes the values to go to the idle decal, but the running one doesn't change at all.
Anyone have an explanation for this?
EDIT: The running event also occurs randomly when I'm idle after jumping. I'm guessing this is because of how the ROBLOX character now works, and it's kind of frustrating.
Any help is appreciated, thanks!
Code snippet (jumping and running variables are defined earlier in the script):
function State(state) print("State Change: "..tostring(state)) --Just to check if it was working. if state == Enum.HumanoidStateType.FallingDown or state == Enum.HumanoidStateType.Jumping or state == Enum.HumanoidStateType.Freefall then print("Jumping") --We're jumping jumping = true running = false elseif state == Enum.HumanoidStateType.Running or state == Enum.HumanoidStateType.RunningNoPhysics then print("Running") --We're running jumping = false running = true else print("Idle") --We go to idle after jumping, but not after running. Why? jumping = false running = false end end