So, I have this script that spawns in random AI cars. Except it only spawns a different car per server. I want it to spawn a different car each time a car is spawned. How do I do that?
local Cars = {5083437873, 5083676767}
whichNum = math.random(1, #Cars)
while wait(1) do
wait(math.random(1,1))
print(("Picked: " .. whichNum))
local root = game:GetService("InsertService"):LoadAsset(Cars[whichNum])
local instances = root:GetChildren()
if #instances == 0 then
root:Remove()
return
end
root = root:GetChildren()
if #root == 1 then
root = root[1]
else return end
print(root)
root.Body.Drive.Disabled = false
root.Parent = workspace
root:MoveTo(Vector3.new(math.random(1,38), 2.999, (math.random(-10000,-2.6))))
end

1 comment
Do you mean each server, the kind of car spawns the same and than different as the server time goes on?