Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

2 comments

0

Bump

0

that's not how this works

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.