I am making a game with character customization, and so that players don't get put in the same area, I have script that clones a new area whenever a player joins, except it only clones it once, and not every time someone joins, I have it set up so that it names the model the player's name once they join, but I'm trying to figure out how to remove a spawn point from the folder that holds the spots where the model can be cloned this is the code.
local AvailableArea = game:GetService("ReplicatedStorage").SpawnPartsForCustomize
local chosenArea = AvailableArea:GetChildren()
local mathClonedArea = chosenArea[math.random(#chosenArea)]
local isAble = mathClonedArea:WaitForChild("IsFilled")
local clonedArea = mathClonedArea:Clone() clonedArea.Parent = workspace
If you save the math.random value to a variable, you can index and destroy the map just like you would when choosing it.
local AvailableArea = game:GetService("ReplicatedStorage").SpawnPartsForCustomize local chosenArea = AvailableArea:GetChildren() local randomArea = math.random(#chosenArea) local mathClonedArea = chosenArea[randomArea] ... chosenArea[randomArea]:Destroy()
Something like this would work, where you clone the area then remove it from where it is so it can't be used again.
randomval = math.random(#chosenArea) local mathClonedArea = chosenArea[randomval]