I have this script where it would loop. It works in Studio, however in-game, it throws an error saying PlayerGui is not a valid member of Script.

Would anyone be able to help? Thanks

for _,a in pairs (game.Players:GetChildren()) do
		if not (a.PlayerGui:findFirstChild("Main")) then