I've been trying this script:
local Gui = script.Parent -- The parent of the script is the gui Gui:Destroy()
Put the GUI in ReplicatedStorage
and make a script in ServerScriptService
to do:
lua
game.Players.PlayerAdded:Connect(function(plr)
local gui = game.ReplicatedStorage.GUI_NAME:Clone()
gui.Parent = plr.PlayerGui
end)
ScreenGui (and other instances which inherit from LayerCollector) have a property called ResetOnRespawn
. Here's the Wiki page.
Here's an answer. As posted by an answer above, all ScreenGuis have an option in the properties tab called "ResetOnSpawn" where if the player dies, and the ResetOnSpawn option is checked, the Gui stays. So an easy fix would be this:
local
Gui
=
script.Parent
Gui.ResetOnSpawn = false
Hope this helps!