Oh, I get it. The problem makes far more sense now that code is supplied. Remember: you should always supply as much detail as possible when asking for support.
Your formula variable isn’t actually a formula. What you are doing there is evaluating an expression where a Vector3 is added as an offset for a CFrame and assigning that to the formula variable. This doesn’t change, so you’re effectively reusing the exact same position for all of your models when going out to place them in the map. You need to change your implementation up a bit.
If you ever only use that one region for your plants, then you can change the position method in the spawnPlants function. The position parameter can be kept as an override, otherwise it should use a random position as in when that function is called.
local function spawnPlants(obj,pos)
local newPlant = obj:Clone()
newPlant.Parent = workspace
newPlant.PrimaryPart:SetNetworkOwner(nil)
if pos then
newPlant:SetPrimaryPartCFrame(pos)
else
local randX = math.random(-75,75)
local randY = math.random(-75,75)
local position = region.CFrame + Vector3.new(randX, 0, randY)
newPlant:SetPrimaryPartCFrame(position)
end
print("Spawned "..newPlant.Name)
end
When calling spawnPlants, don’t pass a second argument. So for your bottom two calls:
spawnPlants(plantsFolder[math.random(1,#plantsFolder)])
Ideally you could resolve this in your initial code by using a new scope per spawnPlants call, but that wouldn’t solve your root misconception of how variable assignment works which is in fact not a formula, the contents on the right hand side get evaluated (“the equation is completed and the answer is returned, which gets assigned to the variable on the left hand side”). What that would have looked like:
for i = 1, 2 do
local randX = math.random(-75,75)
local randY = math.random(-75,75)
local formula = region.CFrame + Vector3.new(randX,0,randY)
spawnPlants(plantsFolder[math.random(1,#plantsFolder)],formula)
end
Makes the variables local to the current iteration and thus are not the same. Don’t use this though, use my advice as offered before this.