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

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

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.

1 comment

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

1 answer

✓ Accepted answer

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 comments

2

Thanks you, you very helped me

0

no problem :)

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