local functionsModule = require(script.ModuleScript)
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local gameFolder = ReplicatedStorage.Game
local status = gameFolder.Status
local CONSTANTS = {
requiredPlayers = 4
}
while wait(1) do
local players = {}
repeat wait(1)
for _, player in ipairs(Players:GetPlayers()) do
if player then
table.insert(players, player)
print(string.format("Player was added to Queue: %s", player.Name))
end
end
status.Value = string.format("Waiting for enough players ( %s %s %s %s", #players, "/", CONSTANTS.requiredPlayers, " )")
until #players >= CONSTANTS.requiredPlayers
end
So, for some reason my script adds me again and again in the players table when it is supposed to add me only the first time, it doesn’t seem to work as expected.