So, ive got this script that is supposed to spawn 20 rocks inside the given area, and then only spawn more when there are less than 20, all the way back up to 20. i get no errors, but it doesnt spawn anything. a
local function GenerateRocks() for i = 1, 20 do local numberofrocks = workspace.Rocks:GetChildren() local RockClone = game.ReplicatedStorage.Rock1:Clone() if #numberofrocks == 20 then break else RockClone.Parent = workspace.Rocks local RandomX = math.random(-86.341, -71.519) local RandomZ = math.random(136.349, 143.938) RockClone.Position = Vector3.new(RandomX, 2, RandomZ) end end end GenerateRocks()
First of all, you should remove all unused custom arguments in your function, meaning there should be nothing in the parentheses in the first line.
Also, you have to actually activate the function like so:
GenerateRocks()