Every healthbar script i try works fine for the most part, but when i die it doesnt go back to full size when i respawn. It's gotten to the point where im just looking at scripts online and they all still do that
this is the current script im using
-- ScriptGuider -- Basic custom health bar program from my YouTube video -- Video: https://www.youtube.com/watch?v=opZtUhwDWE8 wait() -- ROBLOX made me do this. local Player = game:GetService'Players'.LocalPlayer local Character = Player.Character or Player.CharacterAdded:wait() local Human = Character:WaitForChild("Humanoid") local HealthFrame = script.Parent Human.HealthChanged:connect(function(Health) HealthFrame.Size = UDim2.new(Health/Human.MaxHealth,0,1,0) end)
it seems that you set the screengui ResetOnSpawn to false that makes the script stop working, try to put the character inside a loop like this or you can set it to true instead
local HealthFrame = script.Parent local Player = game.Players.LocalPlayer while wait(0.2) do local Character = Player.Character or Player.CharacterAdded:wait() local Human = Character:FindFirstChild("Humanoid") if Human then local Health = Human.Health HealthFrame.Size = UDim2.new(Health/Human.MaxHealth,0,1,0) end end