wait(game.Lighting.TimeToLoad.Value)
-- Health Bar
local HealthB = script.Parent.bk.HBar
repeat until game.Players.LocalPlayer.CharacterAdded:Wait()
game.Players.LocalPlayer.Character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
local redzone = game.Players.LocalPlayer.Character.Humanoid.MaxHealth / 2
if game.Players.LocalPlayer.Character.Humanoid.Health <= redzone then
HealthB.ImageColor3 = Color3.new(255, 0, 0)
end
if game.Players.LocalPlayer.Character.Humanoid.Health > redzone then
local brickcolor = BrickColor.new("Lime green")
local color = brickcolor.Color
HealthB.ImageColor3 = color
end
HealthB.Size = UDim2.new(game.Players.LocalPlayer.Character.Humanoid.Health / game.Players.LocalPlayer.Character.Humanoid.MaxHealth, 0, 0, 20)
end)
COMMUNITY QUESTION
Is there a reason on why this health.Changed script won't work?
1 answer
You cannot add a Changed event to a property like that. It just won't work.
The way to do it is as follows:
game.Players.LocalPlayer.Character.Humanoid:GetPropertyChangedSignal("Health")
:Connect(function()
repeat until game.Players.LocalPlayer.CharacterAdded:Wait()
repeat until are completely unnecessary and are also permanently running, preventing your event from connecting.
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
I was actually using a ImageLabel as the health bar, i updated the question. It still doesn't work even if i used the :GetPropertyChangedSigna;
Just noticed something before that. Updated Answer
Gui Object's changed event still fires from their position updating.
It works, but when the player's health is lowered it gets smaller and moves it position above the frame
Is this a new method? I've never seen it before. Looks neat!
Fairly new
The repeat until wouldn't run forever due to the fact that the
CharacterAdded:Wait()will in fact return the character. It is useless though.