Im trying to do a script where it plays animations depending on your state, all of the work except jump, so heres what i tried
walkanim:Play()
jumpanim:Play()
runanim:Play()
idleanim:Play()
local jumping = false
function checkAnims()
print(jumping)
if hum.MoveDirection.Magnitude == 0 then -- Idle
--print(distance)
runanim:AdjustWeight(0.00001, .3)
walkanim:AdjustWeight(0.00001, 0.5)
idleanim:AdjustWeight(1, 0.3)
jumpanim:AdjustWeight(0.00001, 0.1)
elseif hum.MoveDirection.Magnitude > 0 and script.Parent.CoreMovement.Sprinting.Value == false then -- Walk
--print("Walking")
runanim:AdjustWeight(0.00001, .3)
walkanim:AdjustWeight(1, 0.5)
idleanim:AdjustWeight(0.00001, 0.3)
jumpanim:AdjustWeight(0.00001, 0.1)
elseif hum.MoveDirection.Magnitude > 0 and script.Parent.CoreMovement.Sprinting.Value == true then --Run
--print("Running")
runanim:AdjustWeight(1, 1)
walkanim:AdjustWeight(0.00001, 0.2)
idleanim:AdjustWeight(0.00001, 0.1)
jumpanim:AdjustWeight(0.00001, 0.1)
elseif jumping == true then
print("Jumping")
runanim:AdjustWeight(0.00001, 0.001)
walkanim:AdjustWeight(0.00001, 0.001)
idleanim:AdjustWeight(0.00001, 0.001)
jumpanim:AdjustWeight(1, 1)
end
end
while true do
checkAnims()
local Params = RaycastParams.new()
local origin = hrp.Position
local direction = Vector3.new(0, -5, 0)
Params.FilterType = Enum.RaycastFilterType.Exclude
Params.FilterDescendantsInstances = {script.Parent}
local raycastResult = workspace:Raycast(hrp.Position, direction, Params)
if raycastResult then
if raycastResult.Distance >= 3 then
jumping = true
else
jumping = false
end
end
task.wait()
end
If theres any ohter line of code you need me to show you say below, but yea ive tried this and many others and it still doesnt work