Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make this damage you based on how fast you're falling?

Asked by 9 years ago

Basically, this is from ROBLOX's new sound script. I was wanting to know if it's possible to make this into fall damage. If you're falling from a significant height (enough to make the sound loud), then it would damage you by 25.

if (prevState == "FreeFall" and fallSpeed > 0.1) then
        local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
        sLanding.Volume = vol
        sLanding:Play()
        fallSpeed = 0
    end
0
Bump TheRings0fSaturn 28 — 9y
0
that's not how this works 1waffle1 2908 — 9y

1 answer

Log in to vote
0
Answered by
Myuuckn -5
9 years ago

Maybe you would insert this on your baseplate, whenever you hit the baseplate / bricks or whatever, you get hurt. And sometimes if its a huge height you will die. Try it see if it works, if it doesnt, please message me on ROBLOX, and I will fix the problem.

debounce = false

function Hurt(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
while hum ~= nil and debounce == false do
hum.Health = hum.Health - 25
if hum.Health <= 0 then
break
end
debounce = true
wait(1)
debounce = false
end
end

script.Parent.Touched:connect(Hurt)
Ad

Answer this question