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

How do I check for a certain Health amount?

This script is located inside the Humanoid of a model. I'm trying to detect the health if it's less than or equal 200 then it plays a warning sound. Help?

local H = script.Parent.Health
local Warning = game.Workspace.Warning

while true do
if H <= 200 then
	Warning:Play()
end
if H > 200 then
	Warning:Stop()
end
wait()
end

1 answer

✓ Accepted answer
local H = script.Parent.Health
local Warning = game.Workspace.Warning

while H <= 200 do
wait()
	if not Warning.IsPlaying == true then
		Warning:Play()
	end
end

while H > 200 do
wait()
if Warnin.IsPlaying == true then
	Warning:Stop()
end
end

~Thank me by accepting this answer/bumping up my reputation!

2 comments

0

Seems to freeze the game when testing.

0

Try now.

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