How can I find a descendant of PlayerGui and destroy it threw a Serverscript?

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

PlayerGui does not exist in the server, so you will have to fire a remote event to destroy something in it.

Here’s what you should be doing:

GetGuiName = function(player)
	for _,object in next, player:WaitForChild("PlayerGui"):GetChildren() 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(v)]:Destroy()
	end
end