How do i detect a distance between player's torso and a ground

local FallTrack = nil

  

function PlayTrack()

FallTrack = FallAnim

FallTrack:Play()

end

  

function StopTrack()

if FallTrack then

FallTrack:Stop()

end

FallTrack = nil

end

function OnFallDown()
	PlayTrack()
end


Player.Humanoid.FallingDown:Connect(OnFallDown)

When i just jump and then fall the anim plays. I wanna make when i jump and falls like 5 studs freefall anim plays

6 comments

0

Use ".magnitude".

0

if Player:DistanceFromCharacter(workspace.Baseplate.Position) <= 5 then

0

I dont need the baseplate's position, i need the ground any platform

0

Use raycasting to constantly calculate the distance from the players torso to the ground. https://developer.roblox.com/articles/Raycasting

0

I agree Raycasting would work best

0

thanks!