I am trying to create a Health GUI but when I test it, nothing happens and developer console says character is a nil value. Please help and thank you. Here is my local script:
local humanoid = game.Players.LocalPlayer.Character.Humanoid
humanoid.Changed:Connect(function()
local critical = humanoid.MaxHealth/4
if humanoid.Health <= critical then
script.Parent.BackgroundColor3 = Color3.new(255,0,0)
else
script.Parent.BackgroundColor3 = Color3.new(0,255,0)
end
script.Parent.Size = UDim2.new(0,(humanoid.Health/humanoid.MaxHealth*225),0,40)
end)

1 comment
Thank you.