GUI not working when player resets

Well, I was creating an Admin Panel that would be allocated in Replicated Storage and with a Script I would Clone it for the PlayerGui.

At first I thought everything was working, but when the player resets, the GUI does not appear again.

I was thinking of putting the GUI on the StarterGui, making it Visible and Enabling the Script for whoever is on the list, but I don’t know how safe it can be, what do you think about it? I also thought about using a loop to check if the player on the list has the GUI, and Clone it if not, but maybe there is a better option. I tried to research a little, but I don’t know exactly how I should research to find something that would help me in this case.

Here’s the Script I’m using to filter the players and give the GUI:

local isAdmin = {
	["Player1"] = true,
	["Player2"] = true
}

game.Players.PlayerAdded:Connect(function(player)
	if isAdmin[player.Name] then
		local AP = game.ReplicatedStorage.UIs.AdminPanel:Clone()
		AP.Parent = player.PlayerGui
		AP.Enabled = true
		AP["ap_open"].Disabled = false
	end
end)

Thank you in advance for your attention.

Make sure reset on spawn is on

1 Like

try setting the screengui ResetOnSpawn to false

1 Like

Thought it had to be enabled to keep the UI

1 Like

Go onto the GUI and make sure ResetOnSpawn is false, this will ensure that the gui stays the same when a player respawns.

1 Like

Even though the value is changed, I can understand, this will be useful.

1 Like

Thank you very much, I thought ResetOnSpawn was just to keep the GUI open when the player resets.