How do i make my land anim script only play when landed from a bigger height?

here is my script:
local anim = Instance.new(“Animation”)

anim.AnimationId = “rbxassetid://11664224787”

local playAnim = script.Parent.Humanoid:LoadAnimation(anim)

script.Parent.Humanoid.StateChanged:Connect(function(_, state)

if state == Enum.HumanoidStateType.Landed then

playAnim:Play()

end

end)

You could either raycast from the character’s HumanoidRootPart straight down, or you could create a Variable containing a Vector3 in your script called “GroundHeight” or something, and then get the magnitude of your player’s current height and the GroundHeight.Y, and if that magnitude is bigger than a certain number, start playing your fall animation.

1 Like

i meant land anim my bad ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ ㅤ

The same concept would apply here. I would just include the magnitude of the two positions I stated above in your if statement checking for when the HumanoidState is equal to Land, and then also check if the magnitude is greater than a certain number.

For example:

script.Parent.Humanoid.StateChanged:Connect(function(_, state)

     if state == Enum.HumanoidStateType.Landed and magnitude > insertANumberHere then

          playAnim:Play()

     end

end)
1 Like

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