How to get Fall Damage in Roblox Studio | Tutorial
HTML-код
- Опубликовано: 22 авг 2024
- In todays Video, I will be showing How to get Fall Damage in Roblox Studio!
hope yall liked it Subscribe for more and comment down what yall want next!
Scripts~
In the comments, due to RUclips doesn't want it to be here
My Roblox user, 0winto100win
don't forget to check it out!
Roblox Studio
Roblox Studio Tutorial
-scripts-
local minimum = 10 -- Minimum height a player can get damage from (If a player jumps off a part which is lower than your Minimum number no damage will be done.)
local maximum = 25 -- Maximum height a player can get damage from (If a player jumps off a part which is higher than your Maximum number it will be a garenty death.)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
local rootPart = char:WaitForChild("HumanoidRootPart")
local height
wait(1)
humanoid.FreeFalling:Connect(function(Standing)
if Standing then
height = rootPart.Position.Y
elseif not Standing then
local fallHeight = height - rootPart.Position.Y
if fallHeight >= maximum then
char.Head:Destroy()
elseif fallHeight >= minimum then
humanoid.Health = humanoid.Health -20 -- This is the amount of health a player looses when get fall damage and they are inbetween your Minimum and Maximum numbers, For default it is set to 20, So when a player falls off a part they will loose 20 Health out of their 100 Health.
end
end
end)
end)
end)