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

When health changes problem ?

All it should do is when ur health's lower than 21 make the screen flash when it's above 21 stop the flashing

Now it doesnt work ? why

local humanoid = game.Players.LocalPlayer.Character.Humanoid
local currentHealth = humanoid.Health
local Flash = script.Parent.Flash

humanoid.HealthChanged:connect(function(health)
    if humanoid.Health <= 21 then
	local change = math.abs(currentHealth - health)
    Flash.Visible = true
    wait(0.2)
    Flash.Visible = false
    currentHealth = health
else 
	if humanoid.Health <= 21 then
	return
end
end
end)

5 comments

0

Once you disable a script, you can not reenable it...

0

then how can i do it ?

0

It's only going to flash once every time you go drop a health point below 21. I'm assuming you want it to flash while the hp is below or equal to 21, but this doesn't have a loop and is only going to run when the health changes.

0

Also, on line 11, it's going to change the current health to the amount of health lost. So if you had 21 health, and you lost 13, your health is going to be 13.

0

Then how can i fix this ? i got no ideas ;-;

1 answer

When i tested your script it worked,did you put it in a Local Script?

1 comment

0

Bro did u even read what i wrote... -.-

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