I’ve been working on a lobby system using remote events, and there is a problem where when I send a table of the current players in the hosts lobby, through a remote event, some players are removed from that table for whatever reason.
This is the code that is run on the client:
local players = {}
local playerSpawnNums = {}
for i, v in pairs(game.Workspace.PlayerSpawn:GetChildren()) do
if v:isA("BasePart") then
for b, c in pairs(v:GetChildren()) do
if c.ClassName == "Model" then
table.insert(players, #players, c)
table.insert(playerSpawnNums, #playerSpawnNums, v.Name)
end
end
end
end
game.ReplicatedStorage.PlayerList.Join3:FireServer(players, playerSpawnNums, player)
And this is the code where the server recieves that array:
game.ReplicatedStorage.PlayerList.Join3.OnServerEvent:Connect(function(player, players, playerSpawnNums, ogPlayer)
--the "players" variable is the table of the players
game.ReplicatedStorage.PlayerList.Join4:FireClient(ogPlayer, players, playerSpawnNums, player)
end)
This is the tables results from the client:
This is the tables results from the server:
(Sorry if its obvious or something, im relatively new to lua)