I’m trying to find a descendant of a GUI that is randomly named. It uses random strings for the name so it could not be determined. The script I’ve tried is below.
GetGuiName = function()
for _,object in next, game:GetService("Players"):GetPlayers() do
if object.ClassName == "ScreenGui" then
if object:FindFirstChild("AdminBarHandler") then
return object
end
end
end
end
for _,v in next, game:GetService("Players"):GetPlayers() do
local findGui = v.PlayerGui:FindFirstChild(GetGuiName())
if findGui then
v.PlayerGui[GetGuiName()]:Destroy()
end
end