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

Instance:GetChildren() should be working but it isn't?

Asked by
zomspi 541 Moderation Voter
4 years ago

This script should work but for some reason it doesn't, no errors are shown.

local plrs = game.Players:GetChildren() -- Needs lobby and at least 1 map till complete game (starting, last man standing and intermissions, and a winner)
local isIntermission = true
local i = "Intermission"
local g = "Game In Progress"
game.Players.PlayerAdded:Connect(function(plr)
if #plrs >= 1 then
    if isIntermission == true then
        wait(5)
        game.ReplicatedStorage.IntermissionEvent:FireAllClients(i)
    end
end
end)

Thanks!

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago
local players = game.Players
local isIntermission = true
local i = 'Intermission'
local g = 'Game In Progress'

players.PlayerAdded:Connect(function(player)
    for i,v in pairs(players:GetPlayers()) do
        if i >= 1 and isIntermission then
            print('Starting game')
            wait(5)
            isIntermission = false
            game.ReplicatedStorage.IntermissionEvent:FireAllClients()
            end
        end
    end
end)

NOTE: I'm in school so i can't really test it.

Ad

Answer this question