ray cast down from the humanoid root part, ignore children of the character
something along the lines of this:
function isOnGround (player)
local char = player.Character
if char then
local hrp = char:FindFirstChild("HumanoidRootPart")
if hrp then
local TAGS = Ray.new(hrp.CFrame.p, Vector3.new(0, -3.5, 0)
local hit = workspace:FindPartOnRay(TAGS, char)
if hit then
return true
else
return false
end
end
end
end
you also might be able to use humanoid states to accomplish what you want to do if this does not work for you
|