Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Anti-Fall Damage Script
- local Player = game.Players.LocalPlayer
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local Humanoid = Character:WaitForChild("Humanoid")
- local MaxFallSpeed = 50 -- The maximum fall speed before fall damage is usually applied (can be adjusted)
- -- Function to disable fall damage
- local function disableFallDamage()
- -- Listen to when the humanoid lands on the ground
- Humanoid.FreeFalling:Connect(function()
- -- Check if the player is falling, then monitor their fall speed
- local fallingVelocity = Humanoid.RootPart.Velocity
- -- If the player is falling too fast, set their velocity to a safe value
- if fallingVelocity.Y < -MaxFallSpeed then
- -- Set the velocity to a safe level
- Humanoid.RootPart.Velocity = Vector3.new(fallingVelocity.X, -MaxFallSpeed, fallingVelocity.Z)
- end
- end)
- -- Prevent fall damage by manually updating humanoid health on landing
- Humanoid.Landed:Connect(function()
- if Humanoid.Health > 0 then
- -- Prevent damage upon landing by restoring full health (or a safe amount)
- Humanoid.Health = Humanoid.Health + 0.1 -- Small adjustment to prevent fall damage
- end
- end)
- end
- -- Ensure fall damage is disabled upon respawn
- Player.CharacterAdded:Connect(function(character)
- Character = character
- Humanoid = character:WaitForChild("Humanoid")
- disableFallDamage()
- end)
- -- Call the function to disable fall damage on player spawn
- disableFallDamage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement