So basically what I'm trying to do is remove all the GUIs in the PlayerGui of the player but not the gui called Chat,HelpGui,Clean, and Flare.
local Players = game:GetService('Players');
script.Parent.MouseButton1Click:Connect(function()
game.Players.PlayerAdded:connect(function(plr)
local playerGui = plr.PlayerGui
wait(3)
for i = 1, #playerGui do
local child = playerGui[i];
if child.ClassName == "ScreenGui" and not plr.PlayerGui:GetFirstChildren(Chat,HelpGui,Clean,Flare) then
child:Destroy()
end
end
end)

3 comments
I don't think "GetFirstChildren" is a thing??
Is that the only problem?
Just try having a backup copy in serverstorage or where you prefer keeping your stuff. Then just make it add it after a wait(1). You can just do SafeGUI.Parent = (where you want it)