My ModuleScript is called, ran, then waits until the Modulescript is done to run again. It is supposed to run 25 times in a second (to spawn 25 things, but they all need scripts in them blah blah blah just trust me I need a Modulescript for this) but it runs the first one, then waits till the first one is done to run the second one.
local module = {}
function module.FlyDownAndExplode()
if game:GetService("ReplicatedStorage").RegularArtilleryShelling.Value == true then
local artyshell = script.Parent.ArtyShell:Clone()
local tweenservice = game:GetService("TweenService")
artyshell.Parent = workspace
artyshell.WhistleSound:Play()
artyshell.BillboardGui.Enabled = true
artyshell.CFrame = CFrame.new(math.random(-917, 950), 801.22, math.random(-1002, 980))
repeat
local yPos = artyshell.Position.Y
local goal = {}
goal.Position = Vector3.new(artyshell.CFrame.X, yPos - 15, artyshell.CFrame.Z)
local info = TweenInfo.new(0.1)
local tween = tweenservice:Create(artyshell, info, goal)
tween:Play()
wait(0.05)
until artyshell.CFrame.Y <= 0
artyshell.BillboardGui.Enabled = false
artyshell.ExplosionSound:Play()
artyshell.WhistleSound:Stop()
repeat
artyshell.CFrame = CFrame.new(artyshell.CFrame.X, artyshell.CFrame.Y + 2.5, artyshell.CFrame.Z)
wait(0.00000000000001)
until artyshell.CFrame.Y >= 5
artyshell.Explosion:Emit(150)
artyshell.Explosion:Emit(150)
game:GetService("Debris"):AddItem(artyshell, 5.01)
end
end
return module
Help.