Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local min = 10
- local max = 30
- game.Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function(character)
- local humanoid = character:WaitForChild("Humanoid")
- local rootpart = character:WaitForChild("HumanoidRootPart")
- local playerHeight
- if humanoid and rootpart then
- humanoid.FreeFalling:Connect(function(newState)
- if newState then
- playerHeight = rootpart.Position.Y
- elseif not newState then
- local fallHeight = playerHeight - rootpart.Position.Y
- if fallHeight >= max then
- humanoid.Health = 0
- elseif fallHeight >= min then
- humanoid:TakeDamage(math.floor(fallHeight))
- end
- end
- end)
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement