After a few minutes Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) stops working

So, in the first few minutes after pressing play in studio any command like Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) works perfectly fine but then a few minutes later it completely stops working. Even after disabling all the scripts in the session it still doesn’t work. Video of the issue:


Also, for some reason executing code like this in the command bar:

Humanoid.StateChanged:Connect(function(Old,New)
   print(Old)
   print(New)
end)

fixes it and Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) works again. None of the parts in the rig are anchored.

Humanoid states are super unreliable in general on the server. I would not recommend using them to detect a character’s state. I’m pretty sure I’ve read somewhere roblox staff is aware of this being an issue and have opted to leave it as-is for one reason or another.

There is a pretty useful “FloorMaterial” property you can read from as an alternative in humanoids, just know it’s a somewhat unique property that only checks the floor material when you make a request to read the property.
Listening to it every frame across a lot of npcs can potentially slow the server down, but it didn’t really seem like anything substancial from my testing.

Another tip is that since states are unreliable on the server, a lot of people seem to just outright disable a ton of states on the server for npcs and mobs and the likes. This makes it so the server isn’t doing a ton of useless state checking for it’s network owned npcs.

Yeah, I just learned this earlier. I need an alternative way to make sure that humanoids can jump in an infinite loop consistently. Do you know any? Humanoid.Jump = true in an infinite loop doesn’t seem to work either. I talked to some people in a game and they mentioned that I should try handling it on the client.

I remember running into a similar issue a few months ago. If I recall correctly, the server cannot force player-owned characters to jump, it has to fire a remote telling them to jump (and at that point the client can just use their own reliable states to tell when they land and should jump again).

As for NPCs, you can only make them jump by setting .Jump to true from the server.

Not sure if network ownership affects anything.

This is an NPC. So what you’re saying is that only .Jump works reliably in a loop for NPCs? How come it just disables itself the last time I tried it in a loop?

.Jump disables itself immediately after it’s set to true. It doesn’t reflect the character’s state, rather it’s just a weird way of requesting the humanoid to jump.

When I said .Jump disabling itself I mean as in it refused to jump after setting .Jump = true. This might only apply to player characters though so I will try this again on NPCs.

Edit: So I’ve tried again and it actually does work in a server-sided loop on NPCs. So maybe this behavior only applies to player characters only?

Yeah as stated .Jump is the only way to tell an NPC to jump on the server, and setting your state to Jumping from your client is the only way to make your local character jump. Or if there are other ways I haven’t found them yet.

1 Like

Just want to confirm, are there any downsides of setting .Jump of the NPC on the server?

I mean I don’t see why there would be and nothing on the wiki is implying that you’d get any side effects from using it.

Alright, thanks for the help. I was just paranoid that there would be some potential bug later on. I’ve just changed the Humanoid:ChangeState(Enum.HumanoidStateType.Jumping) to Humanoid.Jump = true and it seems to be working fine.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.