I am trying to remove a teleportation part from a table after a player teleports to it. This is for the spawning part of a game.
The table.remove command is not working. It just shows an error.
ServerScriptService.Server Function:86: invalid argument #1 to ‘remove’ (table expected, got Instance) - Server - Server Function:86
(line 86 is the table.remove)
I tried changing around the order of the arguments, nothing worked. I’m confused.
local Parts = game.workspace.GameSpawn:GetChildren()
for i, Player in ipairs(game:GetService("Players"):GetPlayers()) do
local SelectedPart = Parts[math.random(1, #Parts)]
Player.Character:MoveTo(SelectedPart.Position)
table.remove(SelectedPart,Parts)
print(SelectedPart)
end