Whenever I fall from a high distance, it will only print out small amounts like 2.988454 or something. I am not sure why I am getting these small amounts when I should be getting much greater amounts. Can someone help?
--// Fall Damage
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character.Humanoid
local Danger = false
local Height = 0
local Despacito = Vector3.new(0,0,0)
Humanoid.StateChanged:Connect(function(state)
print(state)
if state == Enum.HumanoidStateType.Freefall then
Danger = true
spawn(function()
while Danger do
wait()
local ray = Ray.new(Character.HumanoidRootPart.Position, Vector3.new(0,-1,0)*5000)
local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
print(part)
if part.Position ~= Despacito then
if part.Position == Despacito then return end
local distance = (Character.HumanoidRootPart.CFrame.p - position).magnitude
print(distance)
Height = distance
Despacito = part.Position
end
end
end)
elseif state == Enum.HumanoidStateType.Landed then
print(Height)
Danger = false
Despacito = Vector3.new()
if Height >= 30 then
print("SUPER DUPER HIGH oHNO")
end
elseif state ~= Enum.HumanoidStateType.Landed and state ~= Enum.HumanoidStateType.Freefall then
Danger = false
end
end)
