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

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

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

2 answers

✓ Accepted answer

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)

3 comments

0

This is in a localscript in workspace?

0

Nevermind, got it. Thanks!

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.

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)

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