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

How to make a roll? (animation when you step on ground)

Asked by 4 years ago

I want to make a roll animation only when character comes to the ground. Without any bugs, have in mind that I can touch not only floor, but a wall too.

0
i suggest using the collection service to tag the floors that you want the animation to be played on and when the floor is touched check the players velocity, if its over a certain number then play the animation Code1400 75 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

ThIs iS NoT a reQuesT SitE

Anyways, Humanoids have an event called .StateChanged which fires when, well, its state changes. This can be many things, from jumping, to falling, to walking, and also landing.

We can work with this given the parameters of .StateChanged

--StarterCharacterScripts

local char = script.Parent;
local humanoid = char:WaitForChild("Humanoid") --Waits until the humanoid loads

humanoid.StateChanged:Connect(function(oldState, newState) --We have the old and new state
    if newState == Enum.HumanoidStateType.Landed then --If we landed...
        --play your animation here
    end
end)
2
Thanks you, you very helped me ArtemVoronin0 171 — 4y
0
no problem :) Utter_Incompetence 856 — 4y
Ad

Answer this question