I made a healthbar with the player's avatar with the name.I have attempted 12 times now and the healthbar doesn't decreased whenever I'm damaged. I've done the script again but it still doesn't work. When I used the Output, it said Argument 1 missing or nil.
local player = game.Players.LocalPlayer
local unitFrame = script.Parent
unitFrame:WaitForChild("Avatar").Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&username=" .. player.Name
unitFrame:WaitForChild("PlayerName").Text = player.Name
local healthBar = unitFrame.HealthBarContainer.HealthBar
player.CharacterAdded:connect(function(character)
local humanoid = character:WaitForChild(Humanoid)
humanoid.HealthChanged:Connect(function(health)
local healthPercentage = health / character.Humanoid.MaxHealth
healthBar.Size = UDim2.new(healthPercentage, 0, 1, 0)
end)
end)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)

2 comments
which line did the error come from?
b a d i n d e n t a t i o n