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

How do I stop a player's GUI from showing again after they die?

Asked by
Relatch 550 Moderation Voter
9 years ago

My intro GUI keeps showing over and over again after players die. I have no idea why it does that. Please help.

2 answers

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

It does that because you put it in StarterGui. Each time a player respawns, everything in StarterGui is cloned into a player's PlayerGui. This means that if your intro is in StarterGui, it will be shown each time a player respawns.

The solution to this is to put the GUI in workspace, then clone it into a player's PlayerGui when they join the game. They will see it, but since it's not in StarterGui it will not be cloned into PlayerGui a second time when they respawn.

game.Players.PlayerAdded:connect(function(plr) --PlayerAdded event
    local gui = game.Workspace:WaitForChild("Gui"):Clone() --Replace with your gui's name, obviously.
    gui.Parent = plr:WaitForChild("PlayerGui") --Parent it to PlayerGui
end)
0
This is in a localscript in workspace? Relatch 550 — 9y
0
Nevermind, got it. Thanks! Relatch 550 — 9y
0
NEVER EVER put a local script in workspace UNLESS you intend to clone it into PlayerGui or Backpack later. LocalScripts don't run in workspace. Perci1 4988 — 9y
Ad
Log in to vote
0
Answered by
Bman8765 270 Moderation Voter
9 years ago

Place the gui in ServerScriptStorage Then when they die it wont clone it again.

local gui = game.ServerStorage.StartingScreen -- location of GUI to insert

game.Players.PlayerAdded:connect(function(player)
    repeat wait() until player.PlayerGui
    gui:Clone().Parent = player.PlayerGui
    print("Clone succesful")
end)

Answer this question