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

When health changes problem ?

Asked by
Bulvyte 388 Moderation Voter
8 years ago
Edited 8 years ago

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)
0
Once you disable a script, you can not reenable it... M39a9am3R 3210 — 8y
0
then how can i do it ? Bulvyte 388 — 8y
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. xxxXMrsAwesomeXxxx 70 — 8y
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. xxxXMrsAwesomeXxxx 70 — 8y
0
Then how can i fix this ? i got no ideas ;-; Bulvyte 388 — 8y

1 answer

Log in to vote
-2
Answered by 8 years ago
Edited 8 years ago

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

0
Bro did u even read what i wrote... -.- Bulvyte 388 — 8y
Ad

Answer this question