So, I’m trying to make fruits spawn on trees. I’m trying to make them not spawn in of each other, not the same position. How would I do that? Btw pos is a part.
Code so far:
local fruits = workspace.Fruits
local vegetation = workspace.Vegetation
for _, veg in pairs(vegetation:GetChildren()) do
local spawnPos = veg.SpawnPos
local fruitToSpawn = veg.FruitToSpawn
spawn(function()
while wait(15) do
local pos = spawnPos:GetChildren()[math.random(1, #spawnPos:GetChildren())]
local fruit = fruitToSpawn.Value:Clone()
fruit.Position = pos.Position
fruit.Parent = fruits
end
end)
end