This GUI is needed to destroy a GUI "NewGame" and clone it form lighting, placing it back in the Localplayers GUI. "NewGame" can freeze up form time to time and I hope this will simulate a refresh.
However after the first use, which works as intended, the second time its clicked the cloned "NewGame" is not destroyed and a second clone form lighting is placed in the playerGui.
here is the script that is in the GUI that is simulating a refresh to "NewGame"
local Gui = game.Players.LocalPlayer.PlayerGui:FindFirstChild("NewGame") script.Parent.MouseButton1Click:connect(function() Gui:Destroy() wait(1) Game.Lighting.NewGame:Clone().Parent = game.Players.LocalPlayer.PlayerGui end)
How can I get "NewGame" to be destroyed on every click?
You need to index your
local Gui
inside your function. Otherwise it is only getting it when the script first runs, and thus doesn't have the updated 'GUI.'