local plr = game.Players.LocalPlayer
local human = plr.Character:WaitForChild("Humanoid")
human.Changed:connect(function(prop)
if prop == "Health" or prop == "MaxHealth" then
script.Parent:TweenSize(UDim2.new(human.Health/human.MaxHealth,0,0,25),"Out","Quad",0.3,true)
end
end)
So I have a custom health bar, and it works fine in test in studio, but when i go to team test or local server it gives me this error:
01:29:51.034 - Players.Activatted.PlayerGui.ScreenGui.Frame.HealthBackground.HealthBox.LocalScript:3: attempt to index field 'Character' (a nil value) I tried adding a wait, but it broke the script completely
