How would I get the tabe of players from a script to another script?

Yes, I do that with the module.

function moduleFunction.AddPlayer(player)
	if player:IsA("Player") then
		if playerInfo.AFK == false then
			playerInfo.InRound = true
			print(player)
			table.insert(moduleFunction.playersInRound, player)
			connections[player.Name] = player.Character.Humanoid.Died:Connect(function()
				table.remove(moduleFunction.playersInRound, table.find(moduleFunction.playersInRound, player))
			end)
		elseif playerInfo.AFK == true then
			warn("Player is afk. Was not added to the list")
			playerInfo.InRound = false
		end	
	end
end
function moduleFunction.RemovePlayer()
	-- Kill the players
	for _, connection in pairs(connections) do
		connection:Disconnect()
		wait()
	end

	for _, player in pairs(moduleFunction.playersInRound)do
		player:LoadCharacter()
		wait()
	end	
	
	playerInfo.InRound = false
	moduleFunction.playersInRound = {}
end 

Can you show me the script where you connect the remote function? Also off topic thing put you donā€™t need to put the wait() at the end of a loop but you can if you want to have a short delay.

this is the server script:

local players = gameModule.playersInRound
playerFunction.OnServerInvoke = function()
	return players
end

Its within the while true do loop. If you want the whole script, Iā€™ll share it through pastebin.

Try using this code, since Iā€™m pretty sure that variable wonā€™t be updated.

playerFunction.OnServerInvoke = function()
	return gameModule.playersInRound
end
1 Like

Thank you so much! After days of developing my spectate system now works perfectly! Couldnā€™t have done it without community help.