How to spawn a function several times?

Hey so i made a module script where when u add it to a barrage it spawns multiple arms hitting the target so for this i did spawn function but idk how to make it repeat for a specific amount of time. can anyone help?

script

spawn(function()
					ArmsVFX.ArmsVFX(character) 
					task.wait(0.1)
				end)

Use a for loop for repetitions

Wait how do I use a loop to repeat it

Introduction to Scripting | Roblox Creator Documentation this should explain how to create one

for i = 1, MAXTIMES do
spawn(function()
	ArmsVFX.ArmsVFX(character) 
	task.wait(0.1)
end)
end

Change maxtimes to how many times u want it spawned.
I would read more about:
https://create.roblox.com/docs/tutorials/scripting/basic-scripting/intro-to-scripting#looping-code

1 Like