Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't my gui appearing again after the player resets or dies?

Alright, so I have this health gui local script and it has the extra ability to identify the player's team by changing it's frame color for example to red or blue and the problem i'm having that it's not appearing when the player resets and there's no even a single error appearing in Output that I can idenfity it's problem, please help any kind of assistance would be appreciated.


while game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name)==nil do 
	game:GetService("RunService").RenderStepped:wait()

end
while game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name):FindFirstChild("Humanoid")==nil do 
	game:GetService("RunService").RenderStepped:wait()
end





	script.Parent:WaitForChild("HPVisual")
	script.Parent:WaitForChild("HPLabel")
	script.Parent:WaitForChild("Critical")
	script.Parent:WaitForChild("HPOutline")
	script.Parent.Parent:WaitForChild("Background")
coroutine.resume(coroutine.create(function()
while true do
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
	game:GetService("RunService").RenderStepped:wait()
	if script.Parent.HPVisual.ImageColor3==Color3.new(1,0,0) then
if script.Parent.Critical.ImageTransparency==1 then
	script.Parent.Critical.ImageTransparency=0
else
    script.Parent.Critical.ImageTransparency=1
end
wait(0.15)
end
end
end))
game:GetService("RunService").RenderStepped:connect(function()
if game.Players.LocalPlayer.Character.Humanoid.Health<=0 then
script.Parent.Visible=false
script.Parent.Parent.Background.Visible=false
end
script.Parent.Parent.Background.BackgroundColor3=game.Players.LocalPlayer.TeamColor.Color
if game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") then
local percent=(math.floor(game.Players.LocalPlayer.Character.Humanoid.Health)/math.floor(game.Players.LocalPlayer.Character.Humanoid.MaxHealth))
script.Parent.HPVisual.ImageRectOffset=Vector2.new(0,((1-percent)*100))
script.Parent.HPVisual.Size=UDim2.new(1,0,percent,0)
script.Parent.HPVisual.Position=UDim2.new(0,0,1-percent,0)
script.Parent.HPLabel.Text=math.floor(game.Players.LocalPlayer.Character.Humanoid.Health)
if math.floor(game.Players.LocalPlayer.Character.Humanoid.Health)<2 and math.floor(game.Players.LocalPlayer.Character.Humanoid.Health)>0 then
script.Parent.HPLabel.Text=1
end
if percent<0.02 and percent>0 then
	percent=0.01
end
if percent<=0.5 then
script.Parent.HPVisual.ImageColor3=Color3.new(1,0,0)
script.Parent.Critical.Visible=true
else
script.Parent.HPVisual.ImageColor3=Color3.new(1,1,1)
script.Parent.Critical.Visible=false
end
end
end)

1 comment

0

Hey just go in the properties of the GUI and set to false "ResetAtSpawn".

1 answer

I'm pretty sure there's an option you can tick on the gui if you want it to reset on player death. https://gyazo.com/5311b024e17c0bb3fbdd6d8f261ea493

4 comments

0

Yeah but my gui already automatically has that property checked and it still keeps dissapearing.

0

I'm looking at the script and it doesn't, try ticking it and see what happens.

0

Nope, I've tried again and still dissapears.

0

There is also a property just like this in the StarterGui. Try that as well.

This discussion is preserved as it was. New answers, comments, and votes are closed.