so im trying to make a attack clone something x times.
i could just copy & paste this script, but i want it to be random.
Bomb.Parent = workspace
Bomb.Position = SpawnerPart
BombClone.Velocity = Vector3.new(0,20,0)
so im trying to make a attack clone something x times.
i could just copy & paste this script, but i want it to be random.
Bomb.Parent = workspace
Bomb.Position = SpawnerPart
BombClone.Velocity = Vector3.new(0,20,0)
Run a loop.
for count = 1, 10 do
-- Clone stuff here
end
this could work but i want it to randomize once, it’s in a function so i can do, now that i think about yeah this won’t work
local BombAmount = math.random(3,10)
local BombCount = math.random(3,10)
for i = 0, BombCount do
-- Clone the bomb etc.
end
It should work and keep on going until your randomized bomb count has been reached
By declaring the random amount outside of the loop it is only calculated once.
If this code is in a function, make sure you’re calling the function once and not multiple times.