Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
1
Answered by
yHasteeD 1819 Moderation Voter
6 years ago
Edited 5 years ago

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.
0
Thank you! I'll try! ProvingTrottle 27 — 6y
Ad

Answer this question