I'm also wanting to make it continue under that part count, but I just don't know how. Please help!
local Region = game.workspace.Region local Rep = game:GetService("ReplicatedStorage") local Mine = game.ReplicatedStorage.LandMine local x = Region.Position.x local z = Region.Position.Z local xS = Region.Size.X/2 local xZ = Region.Size.Z/2 while true do local newmine = Mine:Clone() newmine.Parent = workspace local pos1 = math.random(x-xS,x+xS) local pos2 = math.random(z-xZ,z+xZ) newmine.Position = Vector3.new(pos1,0.2,pos2) wait(1) end
Howdy!
There are many ways, such as using the break
feature or simply setting the loop to run under certain circumstance. Here is an example of using the certain circumstance way.
local MineCount = 0 while MineCount > 20 do local newmine = Mine:Clone() newmine.Parent = workspace MineCount = Minecount + 1 local pos1 = math.random(x-xS,x+xS) local pos2 = math.random(z-xZ,z+xZ) newmine.Position = Vector3.new(pos1,0.2,pos2) wait(1) end
This would continue until you hit 20, where it will then stop running.
If this helped you out, consider accepting this answer for those sweet, sweet reputation points. If not, comment below and I (or someone else) will help you out.