Hello!
I was working on my game until I ran into a problem.
I was trying to make it so that everytime the player dies an admin gui i made gets cloned back into their playergui.
But the problem is that the script only worked once.
After a third death the script won’t work anymore.
Script
task.wait(2)
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
Character.Humanoid.Died:Connect(function()
task.wait(7)
game:GetService("ReplicatedStorage"):WaitForChild("AdminGUI", 1000):Clone().Parent = Player.PlayerGui
end)
The way I clone the admin gui to the player once
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GetAdminPanelEvent = ReplicatedStorage:WaitForChild("GetAdminPanelEvent", 1000)
GetAdminPanelEvent.OnServerEvent:Connect(function(Player)
local AdminGui = game:GetService("ReplicatedStorage"):WaitForChild("AdminGUI")
AdminGui:Clone().Parent = Player.PlayerGui
end)