How do I make a script, that deletes any new UI’s in the Player’s UI, apart from the existing UI’s in Startergui? As a small quality of life thing for me, it’s not really a security measure, because of Filtering Enabled, but yeah.
tried this as a local script (would prefer if it’s serversided though):
local function deleteNonStarterGuiChildren()
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local starterGui = game.StarterGui
while wait(1) do
for _, child in ipairs(playerGui:GetChildren()) do
if child:IsA("GuiObject") and not starterGui:FindFirstChild(child.Name) then
child:Destroy()
end
end
end
end
deleteNonStarterGuiChildren()