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)
Every time script.Parent
is clicked, all ScreenGuis not called "Chat", "HelpGui", "Clean", or "Flare" are all removed
local Players = game:GetService('Players') local LocalPlayer = Players.LocalPlayer local Guis = LocalPlayer:WaitForChild("Guis") script.Parent.MouseButton1Click:Connect(function() wait(3) local Guis = Guis:GetChildren() for i = 1, #Guis do local Child = Guis[i] if Child.ClassName == "ScreenGui" and not Child.Name == "Chat" and not Child.Name == "HelpGui" and not Child.Name == "Clean" and not Child.Name == "Flare" then Child:Destroy() end end end)