Hi,
I am making a game and i have npc’s there. I want this npcs spawn at the invisible parts i will create but for example i want to have like 10 spawn points (invisible parts) and i want to spawn only 5 npc in random parts and then after i will defeat 1 npc new npc will spawn in the random part that is ready.
This is script i currently use but this script fills the all spawn points and do not leave some for next spawns. After i defeat npc he spawn at the previsious place (the same place). How to make it leave some places and then spawn in random?
local RS = game:GetService("ReplicatedStorage")
local spawnloc = workspace:WaitForChild("SpawnLoc")
while true do
for _, location in pairs(spawnloc:GetChildren()) do
if location.ClassName == "Part" and location:WaitForChild("Ready").Value == true then
location:WaitForChild("Ready").Value = false
local npc = RS:WaitForChild("NPCs"):FindFirstChild(location.Name):Clone()
npc.HumanoidRootPart.CFrame = CFrame.new(location.Position)
npc.Parent = workspace["Zone 1"]
end
end
wait(10)
end