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

Gui appears when player first joins, but won't after they die?

local player = script.Parent.Parent
local playerGui = player:FindFirstChild("PlayerGui")

if not playerGui:FindFirstChild("mainMenuCopy") then
	local menuGui = game.ReplicatedStorage.mainMenu:clone()
	menuGui.Parent = playerGui
	menuGui.Name = "mainMenuCopy"
end

Basically, this is the main menu, which leads to thing like character creation, shop, options, etc, and all of those tabs work fine, it switches between them fine and all that. But then I did the reset test, and now none of the Gui appears after respawning, and yes, "ResetPlayerGuiOnRespawn" is checked. Thanks for the help in advance!

1 answer

✓ Accepted answer
function onPlayerRespawned(newPlayer)
	print("A player has entered: " .. player.Name)
local player = script.Parent.Parent
local playerGui = player:FindFirstChild("PlayerGui")

if not playerGui:FindFirstChild("mainMenuCopy") then
    local menuGui = game.ReplicatedStorage.mainMenu:clone()
    menuGui.Parent = playerGui
    menuGui.Name = "mainMenuCopy"
end
end)
script.Parent.ChildAdded:connect(onPlayerRespawned)

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