You can write your topic however you want, but you need to answer these questions:
-
when the player jumps a animation plays, when they land depending on how far they fell from either a light landing animation will play or a heavy landing animation simulating they just fell from a great height
-
the issue is, it wants to play the big landing twice in a row, before registering small landings, so i can jump from a high place and get the big landing animation and then jump from a small place and get the big animation again, only after that does it start to register small animations
local plyr = game.Players.LocalPlayer
local char = plyr.Character or plyr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local hr = char:WaitForChild("HumanoidRootPart")
local jump = hum:LoadAnimation(script:WaitForChild("Jump"))
local walk = script:WaitForChild("Walk")
local run = script:WaitForChild("Run")
local idle = script:WaitForChild("Idle")
local freefall = hum:LoadAnimation(script:WaitForChild("FreeFall"))
local maybigfall = false
local initpos = nil
function AdvancedJumpDetection()
end
hum.StateChanged:connect(function(oldstate, newstate)
if newstate == Enum.HumanoidStateType.Jumping then
jump:Play()
initpos = hr.Position
hum.FreeFalling:connect(function()
if maybigfall == false then
local currentpos = hr.Position
local distancefell = (initpos-currentpos).magnitude
print(distancefell)
if distancefell >= 30 then
maybigfall = true
elseif distancefell < 30 then
maybigfall = false
end
else
end
end)
elseif newstate == Enum.HumanoidStateType.Landed then
jump:Stop()
if maybigfall == false then
maybigfall = false
print("small fall")
spawn(function()
hum.JumpPower = 0
wait(2)
hum.JumpPower = 50
end)
hum:LoadAnimation(script:WaitForChild("RegFall")):Play()
elseif maybigfall == true then
print("bigfall")
maybigfall = false
hum:LoadAnimation(script:WaitForChild("BigFall")):Play()
spawn(function()
hum.JumpPower = 0
hum.WalkSpeed = 0
wait(2)
hum.JumpPower = 50
hum.WalkSpeed = 16
end)
end
end
end)
I just want it to properly and reliably differentiate between if it should play the light landing or heavy landing animation