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

How to detect if player is jumping or moving?

Yeah I just need to know how you detect these thanks.

1 answer

✓ Accepted answer

The humanoid has an event called StateChanged that fires when the humanoid starts doing another activity like jumping, swimming, walking, et cetera. This event returns the old state and the new state as a HumanoidStateType which is an enumeration. For moving, there is a humanoid state type called Running, and for jumping, there is a state appropriately called Jumping.

Humanoid.StateChanged:Connect(function(old , new)
	if new == Enum.HumanoidStateType.Running then
		--Player is running
	elseif new == Enum.HumanoidStateType.Jumping then
		--Player has jumped
	end
end)

1 comment

0

Thank you!

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