The Code In StarterCharacterScript -
local char = script.Parent char.Changed:connect(function() print("ads") local hum = char.Humanoid local health = hum.Health local maxHealth = hum.MaxHealth char.Head.HealthBar.GreenBar.Size = UDim2.new(health/maxHealth,0,1,0) end)
Also the Billboard GUI is in the characters head
Whenever the humanoid takes damage the green bar wont scale to its health.
Also its a billboard GUI in the players head
If I am correct,
char is referencing the Player's model instead of the humanoid.
If you want the healthbar to update when the player takes damage, then the function must fire when the humanoid changes (specifically the humanoid's health).
Try using this:
local char = script.Parent local human = char:FindFirstChild('Humanoid') human.Changed:connect(function() print('test') local health = human.Health local maxhealth = human.MaxHealth char.Head.HealthBar.GreenBar.Size = UDim2.new(health/maxHealth,0,1,0) end)