Hi
In my game loop I spawn coins to points added to my map.
for i, coin in pairs(AvailableCoinSpawnPoints) do
if coin then
currentRandomCoinNum = math.random(1, #AvailableCoinSpawnPoints)
positionCoin = AvailableCoinSpawnPoints[currentRandomCoinNum]
MyCoinTmp = ServerStorage.Coin
MyCoin = MyCoinTmp:Clone()
MyCoin.Parent = workspace
MyCoin.CFrame = positionCoin.CFrame
table.remove(AvailableCoinSpawnPoints,currentRandomCoinNum)
end
end
This works fine the first time my game loops. When I have a winner the game quits and enters the lobby. When the game start over again the coins are spawn inside the already existing coins. And after a few rounds there are multiple coins spinning inside each other on the spawn point. I am thinking that AvailableCoinSpawnPoints would be refreshed when the map is destroyed (before the last player is sent to the lobby)?
Anyone know how I can spawn a fresh set of coins everytime a game starts?

1 comment
Thanks. I answered below.