so let's say i want to move something from my table (temporarily) and put it back in later, how would I do it?
ways that are not permitted in this instance: making another table, removing it from the first and adding it to the second keeping its position the same.
local rndm = math.random(1, #spawns) model.PrimaryPart.CFrame = spawns[rndm] table.insert(usedspawns, rndm, spawns[rndm]) table.remove(spawns, rndm) model.Name = kind model.Humanoid.Died:Connect(function() table.insert(spawns, rndm, usedspawns[rndm]) table.remove(usedspawns, rndm) model:Destroy() wait(5) createchar(kind) end)
script above is part of a function that generates a randomly created character, including a randomized spawn location placed inside a table, the current method is not good because it will error saying "CFrame expected, found nil" because math.random searches from 1 to the last number of the array, meanwhile the array has missing numbers like 5,6 etc.