You could use a 2D array to store all the worlds, and then within them store all the players IDs (easier to use with a function which will be used in a minute, plus easier to differentiate players) within those worlds. For example,
local worldsData = {
{11923173, 68735475, 82372149, 39247329} -- Would be world 1 as it's the first index
{58634854, 38148123, 20138431} -- World 2
{} -- etc etc
}
Then, you could use a function to get all the players by running through this table.
local worldData = -- worlds table here
local function GetPlayersInWorld(worldNum)
local playerTable = {}
for _, v in pairs(worldData[worldNum]) do
playerTable:insert(game.Players:GetPlayerByUserID(v)) -- Inserts the player reference into the array
end
return playerTable
end