I'm trying to make a gui that changes color along with a Humanoid (in workspace) health. But all that happens is it turns black (the part of the gui I'm working with) and doesnt do anything. Any help is appreciated :D
while true do
MyGuy = script.Parent.Parent.Header.Text
Note = game.Workspace:FindFirstChild(""..MyGuy)
Health = Note.Humanoid.Health
MaxHealth = Note.Humanoid.MaxHealth
All = Health / MaxHealth
Color = script.Parent.BackgroundColor3
if All >= .8 then Color = Color3.new(0,170,0)
if All >= .6 and All < .8 then Color = Color3.new(102, 170, 12)
if All >= .4 and All < .6 then Color = Color3.new(255, 255, 0)
if All >= .2 and All < .4 then Color = Color3.new(255, 170, 0)
if All > 0 and All < .2 then Color = Color3.new(255, 0, 0)
if All == 0 then Color = Color3.new(255,255,255)
script.Parent.Text = ""..script.Parent.Text.."(Dead)"
end
end
end
end
end
end
end
This is what it has come to
while true do
wait (1)
MyGuy = script.Parent.Text
Note = game.Workspace:WaitForChild(MyGuy)
Humanoid = Note:WaitForChild("Humanoid")
Color = script.Parent
if (Humanoid.Health / Humanoid.MaxHealth) >= .8
then Color.BackgroundColor3 = Color3.new(0,170,0)
if (Humanoid.Health / Humanoid.MaxHealth) >= .6
and (Humanoid.Health / Humanoid.MaxHealth) < .8
then Color.BackgroundColor3 = Color3.new(102/255, 170/255, 12/255)
if (Humanoid.Health / Humanoid.MaxHealth) >= .4
and (Humanoid.Health / Humanoid.MaxHealth) < .6
then Color.BackgroundColor3 = Color3.new(255/255, 255/255, 0)
if (Humanoid.Health / Humanoid.MaxHealth) >= .2
and (Humanoid.Health / Humanoid.MaxHealth) < .4
then Color.BackgroundColor3 = Color3.new(255/255, 170/255, 0)
if (Humanoid.Health / Humanoid.MaxHealth) > 0
and (Humanoid.Health / Humanoid.MaxHealth) < .2
then Color.BackgroundColor3 = Color3.new(255/255, 0, 0)
if (Humanoid.Health / Humanoid.MaxHealth) == 0
then Color.BackgroundColor3 = Color3.new(255/255,255/255,255/255)
script.Parent.Text = script.Parent.Text.."(Dead)"
end
end
end
end
end
end
end
No clue why, but it still is not working =/

2 comments
@BSI 1/30 of a second is how fast animations and movies roll at. If you take an animation and but wait(0.1) at it then It would be way too slow. GIFs move at around 1/30 of a second.
oh, good to know, thanks