My health bar seems to be working properly in studio, but doesn't work in game. I'm not sure if this is an issue with roblox or something. Here's the code.
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function()
local redzone = game.Players.LocalPlayer.Character.Humanoid.MaxHealth/5
if game.Players.LocalPlayer.Character.Humanoid.Health <= redzone then
script.Parent.BackgroundColor3 = Color3.new(255,0,0)
end
if game.Players.LocalPlayer.Character.Humanoid.Health > redzone then
local brickcolor = BrickColor.new("Deep orange")
local color = brickcolor.Color
script.Parent.BackgroundColor3 = color
end
script.Parent.Size = UDim2.new(game.Players.LocalPlayer.Character.Humanoid.Health / game.Players.LocalPlayer.Character.Humanoid.MaxHealth,0,0,20)
end)
Please let me know if there's anything wrong with my script or if there's a solution, thank you.

1 comment
Thank you, I will try not to jump to conclusions next time, and try to find out whatever's wrong with my script.