Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] How to make a GUI show up every minute to every player at the same time?

Does anybody know how to make a GUI show up every minute to every player at the same time? Any help would be appreciated!

Details:

This is my script:

local startGui = game.ServerStorage.StartingGui

while true do
	wait(60)
	for i, v in pairs(game.Players) do
		local GuiClone = startGui:Clone()
		GuiClone.Parent = v.PlayerGui
	end
end

I got this error:

10:08:45.375 - ServerScriptService.Script:5: bad argument #1 to 'pairs' (table expected, got Object)

1 answer

✓ Accepted answer

You need to use :GetPlayers() after game.Players

Here is fixed script:

local startGui = game.ServerStorage.StartingGui

while true do
	wait(60)
	for i, v in pairs(game.Players:GetPlayers()) do
	    if v:FindFirstChild("PlayerGui") then -- Check for PlayerGui
			local GuiClone = startGui:Clone()
			GuiClone.Parent = v.PlayerGui
	    end
	end
end

Wiki pages:

GetPlayers

FindFirstChild

Errors? tell-me on comments.

Hope it helped :)

Solved your problems? put in title [SOLVED] or accept a answer.

1 comment

0

Thank you! I'll try!

This discussion is preserved as it was. New answers, comments, and votes are closed.