Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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)
0
Hey just go in the properties of the GUI and set to false "ResetAtSpawn". TheRealPotatoChips 793 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
Yeah but my gui already automatically has that property checked and it still keeps dissapearing. Simpletton 82 — 5y
0
I'm looking at the script and it doesn't, try ticking it and see what happens. llMasonIl 12 — 5y
0
Nope, I've tried again and still dissapears. Simpletton 82 — 5y
0
There is also a property just like this in the StarterGui. Try that as well. throwawayaccount2001 102 — 5y
Ad

Answer this question