local settingsDir = script.Settings function getSetting (name) return settingsDir and settingsDir:FindFirstChild(name) and settingsDir[name].Value end local damageHeight = getSetting("Damaging height") or 5 -- The height at which the player will start getting damaged at local lethalHeight = getSetting("Lethal height") or 26 -- The height at which the player will get killed game:GetService("Players").PlayerAdded:Connect(function (plr) plr.CharacterAdded:Connect(function (char) local root = char:WaitForChild("HumanoidRootPart") local humanoid = char:WaitForChild("Humanoid") if humanoid and root then local headHeight wait(3) humanoid.FreeFalling:Connect(function (state) if state then headHeight = root.Position.Y elseif not state and headHeight ~= nil then pcall(function () local fell = headHeight - root.Position.Y if fell >= lethalHeight then humanoid.Health = 0 elseif fell >= damageHeight then humanoid.Health = humanoid.Health - math.floor(fell) end end) end end) end end) end)
@jengaman422
3 ай бұрын
you have earned a sub and like
@nobelcourses
3 ай бұрын
Thank you 🙌
@sandenjoyer
Жыл бұрын
finally a good tutorial, deserved like
@nobelcourses
10 ай бұрын
Glad you enjoyed the tutorial :)
@GAMING_F3X
Жыл бұрын
😀Thanks
@Loganglicklepickle
3 ай бұрын
thats a sub
@Cryaboutit447
7 ай бұрын
This is really cool but I have a question, how would I make this but it breaks my leg when I fall? Like an animation play? I have been trying to make it for 1 week now and I have nothing
@nobelcourses
7 ай бұрын
Hey you will have to add a script that activates the animation only when the player gets fall damage. Send us a message with your script we will be able to help you :) Or on Facebook Nobel Courses
@Cryaboutit447
7 ай бұрын
local MaxVelocity = script:WaitForChild("MaxallDistance") local MinVelocity = script:WaitForChild("MinimumFallDistance") game.Players.PlayerAdded:Connect(function(Plr) Plr.CharacterAdded:Connect(function(Char) local Humanoid = Char:WaitForChild("Humanoid") local HumanoidRootPart = Char:WaitForChild("HumanoidRootPart") Humanoid.StateChanged:Connect(function(OldState, NewState) local PlrVelocity = HumanoidRootPart.Velocity.Y PlrVelocity *= -1 if PlrVelocity > MaxVelocity.Value then Humanoid.Health = 1 Humanoid.WalkSpeed = 0 Humanoid.JumpHeight = 0 --i need animation to play here --this isnt in player scripts this is a script in the workspace wait(10) Humanoid.Health = 0 elseif PlrVelocity > MinVelocity.Value then Humanoid.Health -= PlrVelocity / 4 end end) end) end) @@nobelcourses that is my script
@ArnoSajesh-zp9sn
5 ай бұрын
just add a death animation so whan you die it plays an animation
Пікірлер: 15