I was making an easy fall damage script by monitoring root velocity following this post Best way to make fall damage? - #5 by Weldify . But the fallVelocity always prints 0 no matter how high I fall from.
I have tried to measure the velocity of baseParts too but they also show 0. Have I done something wrong in the script? Or Roblox doesn’t measure velocity anymore?
This is the server script:
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
local root=Character:WaitForChild("HumanoidRootPart")
local damagePerVelocity=10
local fallVelocity = root.Velocity.Y
Humanoid.StateChanged:Connect(function (old, new)
if old==Enum.HumanoidStateType.Freefall and new==Enum.HumanoidStateType.Landed then
print(old)
print(new)
print(fallVelocity)
if fallVelocity>1 then
Humanoid:TakeDamage(fallVelocity * damagePerVelocity)
end
end
end)
end)
end)
Sorry If I don’t reply soon, Its 1 AM here