I want the script to send by remote event an array list of the players that have a frame in the scrolling frame
The issue is that when i print the table it prints a empty table
Note that every frame in the groupscrollingframe is the name of the player This array list is also send to the server so the players in it can be teleported with TeleportAsync()
Frame.StartButton.MouseButton1Click:Connect(function()
if Frame.GroupScrollingFrame:FindFirstChildOfClass("Frame") then
local Players = {}
for i, frame in pairs(Frame.GroupScrollingFrame:GetChildren()) do
if frame:IsA("Frame") then
for i, player in pairs(game.Players:GetPlayers()) do
if player.Name == frame.Name then
table.insert(Players, game.Players:GetPlayers()[player])
end
end
end
end
table.insert(Players, localPlayer.Name)
print(Players)
RS.TeleportPlayer:FireServer(Players)
end
end)
Players:GetPlayers() returns a table which is an array of all the Players currently in the server.
It returns a table indexed with numbers, not other Instance references.
For example a table recieved with Players:GetPlayers() may go as:
{
[1] = Player1,
[2] = Player2,
[3] = Player3,
}
Try doing table.insert(Players, player) instead.
Since you already know which player instance it is.