I made a working health bar that decreases with the player's health, and it works perfectly on Studio, but it does not respond on Play mode. Any ideas what I am doing wrong?
PD : It is under a LocalScript...
Code :
player = game.Players.LocalPlayer
char = player.Character
human = char.Humanoid
HP = script.Parent
while wait() do
HP:TweenSize(UDim2.new(0, (human.Health*311)/human.MaxHealth, 0, 24))
if HP.Size.X.Offset <= 165 and HP.Size.X.Offset > 25 then
HP.BackgroundColor3 = Color3.new(200/255, 200/255, 0)
else if HP.Size.X.Offset <= 25 then
HP.BackgroundColor3 = Color3.new(200/255, 0, 0)
else
HP.BackgroundColor3 = Color3.new(110/255, 185/255, 20/255)
end
end
end
Any help is appreciated!
TheArmoredReaper

2 comments
Is this a local script or a server script?
LocalScript under StarterGUI. The output does not give any errors (at least in Studio)