Hi, for everyone who reads this would be nice if you help me
so i just have a question on how to do this because i already searched on Youtube and i could not find something.
Is there a way to make it like if a player drops from 50 studs he plays a animation if he hits the ground?
idk if this is possible but would be nice if you help me.
Have a Great Day
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local falling = false
local startpos = nil
while true do
wait()
if hum.FloorMaterial == Enum.Material.Air and falling == false then
falling = true
local fallpos = nil
startpos = char.HumanoidRootPart.Position
repeat
wait()
if char.HumanoidRootPart then
fallpos = char.HumanoidRootPart.Position
end
until
hum.FloorMaterial ~= Enum.Material.Air
falling = false
if fallpos ~= nil and startpos ~= nil then
print((Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude .. "studs fell")
if (Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude >= 50 then
-- ur animation script
end
end
end
end
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local animations = char:WaitForChild("Animations")
local animation = char.Animations.FallAnimation
local animplayer = hum:LoadAnimation(animation)
local falling = false
local startpos = nil
while true do
wait()
if hum.FloorMaterial == Enum.Material.Air and falling == false then
falling = true
local fallpos = nil
startpos = char.HumanoidRootPart.Position
repeat
wait()
if char.HumanoidRootPart then
fallpos = char.HumanoidRootPart.Position
end
until
hum.FloorMaterial ~= Enum.Material.Air
falling = false
if fallpos ~= nil and startpos ~= nil then
print((Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude .. "studs fell")
if (Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude >= 50 and hum then
animplayer:Play()
hum.WalkSpeed = 0
hum.JumpPower = 0
wait(1)
hum.WalkSpeed = 16 --normal walkspeed
hum.JumpPower = 50 --normal jumppower
end
end
end
end
change FallAnimations AnimationId to the animation u want
oh wait just one quick question is there a way to make it so the animation plays longer
like right now i just hit the ground and it plays the animation for around idk 0.5 second