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

How would I add sound to this?

When ever you take damage, such as if it's more than 50, it'll play a sound, and if it's below 50, it'll play a sound and if it's below 20, it plays a sound?

local self = script.Parent
local Humanoid = self:WaitForChild("Humanoid")
local Regen = false
Humanoid.HealthChanged:connect(function()
	if (not Regen and Humanoid.Health > 0) then
		Regen = false
		while (Humanoid.MaxHealth > Humanoid.Health) do
			local NewHealth = Humanoid.Health + (Humanoid.Health/Humanoid.MaxHealth) + 0.5
			Humanoid.Health = NewHealth
			wait(Humanoid.Health/Humanoid.MaxHealth * 0.00001)
		end
		if (Humanoid.MaxHealth < Humanoid.Health) then
			Humanoid.Health = Humanoid.MaxHealth
		end
		Regen = false
	end
end)

1 answer

Add more if statements! Although, I don't know what you're really asking for with the more than 50 and all that.

2 comments

0

Like, in Serious Sam. If you take a lot of damage your guy will go "OOOOHHHHH!!!!" or something like that. lol

0

More. If. Statements.

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