Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to detect if player is jumping or moving?

Asked by 6 years ago

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

1 answer

Log in to vote
0
Answered by
RayCurse 1518 Moderation Voter
6 years ago
Edited 6 years ago

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)
0
Thank you! Mr_MilkysButler 47 — 6y
Ad

Answer this question