I have a script thats supposed to change a custom health bars color depending on the current health of the player.
But unfortunately its not working, there is also no error?
Heres the code
wait(1)
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local HealthBar = script.Parent.HealthBar
local Background = script.Parent
if Humanoid.Health >= 76 then
HealthBar.BackgroundColor3 = Color3.new(234/255, 234/255, 0/255)
elseif Humanoid.Health <= 75 then
HealthBar.BackgroundColor3 = Color3.new(255/255, 170/255, 0/255)
elseif Humanoid.Health <= 50 then
HealthBar.BackgroundColor3 = Color3.new(217/255, 0/255, 0/255)
end
function Update()
local HP = Humanoid.Health / Humanoid.MaxHealth
script.Parent.HealthNumber.Text = math.floor(Humanoid.Health + .5)
HealthBar:TweenSize(UDim2.new(HP, 0, 1, 0), "Out", "Elastic", .1, true)
wait(.1)
end
Update()
Humanoid.Changed:connect(Update)
anyone have any ideas?? Thank you for your time :)

1 comment
Well, you made the healthbar, so I assume you know the directory to the healthbars color, maybe try double checking, reading over the code carefully