Basically I have an admin GUI and when you join it clones it from repstorage to player.PlayerGUI
But when you die or respawn it goes away. How do I fix this?
Code:
local Players = game:GetService("Players")
local gui = game:GetService("ReplicatedStorage").Panel
Players.PlayerAdded:Connect(function(player)
if admins[player.Name] == true then
local panel = gui:Clone()
panel.Parent = player.PlayerGui
end
end)
but in your script, you out it into the startergui, I assume that is just a typo for the post.
you have 2 options, change the event to .CharacterAdded so it adds the panel everytiem the character is added, or change the ScreenGui ResetOnSpawn property to false
edit: I said “change the event to”, but that is wrong, the post below is correct about adding it inside the playeradded event
This only creates it when the player enters the game, instead you want to create it every time the players character is spawned in, which can be done by adding .CharacterAdded:Connect(function() under the .PlayerAdded line
example:
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
Clone Script Here
end)
end)