FoxTermBit
(FoxTermBit)
September 29, 2022, 6:17am
#1
code
Character.Humanoid.HealthChanged:Connect(function()
healthbar.Bar.Size = UDim2.new(1/(Character.Humanoid.MaxHealth/Character.Humanoid.Health),0,1,0)
healthbar.Bar.BackgroundColor3 = Color3.fromRGB(-255-Character.Humanoid.MaxHealth/Character.Humanoid.Health,255-Character.Humanoid.MaxHealth/Character.Humanoid.Health,0)
end)
problem is when player damaging he just getting yellow bar not green when fully healed or red when near death just yellow (i experemented and got even worse)(im bad at math ;c )
please help
Try this: make a function that determines the humanoid’s health and then run that function to determine what colour the health bar should be.
FoxTermBit
(FoxTermBit)
September 29, 2022, 7:05am
#3
thats probably gonna be useless
Fauxtyai
(バーガーキング フットレタス)
September 29, 2022, 11:28am
#4
Character.Humanoid.HealthChanged:Connect(function()
healthbar.Bar.Size = UDim2.new(Character.Humanoid.Health / Character.Humanoid.MaxHealth, 0, 1, 0)
healthbar.Bar.BackgroundColor3 = Color3.fromRGB(
255 * (Character.Humanoid.Health / Character.Humanoid.MaxHealth),
255 * (1 - (Character.Humanoid.MaxHealth/Character.Humanoid.Health)),
0
)
end)
FoxTermBit
(FoxTermBit)
September 29, 2022, 12:09pm
#5
i just found thats
Color3.new(-1*Character.Humanoid.Health/Character.Humanoid.MaxHealth,Character.Humanoid.Health/Character.Humanoid.MaxHealth,0)
does the job but when its half of health yellow color just dirt color