Hello!
I was coding game named “Shoot the noob”
But when noob died then will spawn a new at random location but there is problem
It is still spawing on same place unless there is more than 10 spawns that can choose
Script:
game.Workspace.Noobs.ChildRemoved:Connect(function(noob)
local Clone = game.ServerStorage.Noob:Clone()
Clone.Parent = workspace.Noobs
local Folder = game.Workspace.Spawners:GetChildren()
Clone.HumanoidRootPart.Position = Folder[math.random(1,#Folder)].Position
end)
You can have a math.randomseed(tick()) to initiate true randomness. Also, try using after the folder before indexing a random part.
math.randomseed(tick())
game.Workspace.Noobs.ChildRemoved:Connect(function(noob)
local Clone = game.ServerStorage.Noob:Clone()
Clone.Parent = workspace.Noobs
local Folder = game.Workspace.Spawners:GetChildren()
local randomNumber = math.random(#Folder)
Clone.HumanoidRootPart.Position = Folder[randomNumber].Position
print(randomNumber) -- See if this number is different each time
end)