I got this script that is supposed to be a fall damage script, but it doesn’t work. It doesn’t say anything in the output… Help please!
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local startpos local humanoid = char:WaitForChild("Humanoid") humanoid.StateChanged:Connect(function(oldstate, newstate) if newstate == Enum.HumanoidStateType.Freefall then startpos = char:WaitForChild("HumanoidRootPart").Position.Y elseif newstate == Enum.HumanoidStateType.Landed then if not startpos then return end local landpos = char:WaitForChild("HumanoidRootPart").Position.Y if startpos < landpos then return end local distancefallen = (startpos - landpos) humanoid:TakeDamage(distancefallen) end end)
end)
end)
It’s a script inside ServerScriptService.