Title.
Here is my code:
local TweenService = game:GetService("TweenService") local RS = game:GetService("ReplicatedStorage") local enemiesFolder = RS.Enemies local enemySpawn = workspace.EnemySpawns:GetChildren() local moveToParts = workspace.MoveToParts:GetChildren() local randomSpawn = enemySpawn[math.random(1, #enemySpawn)] local randomMoveToPart = moveToParts[math.random(1, #moveToParts)] local function Round1() local Round1Enemy = enemiesFolder.Enemy1:Clone() Round1Enemy.Parent = workspace.Enemies local currentPivot = randomSpawn:GetPivot() Round1Enemy:PivotTo(currentPivot) while wait(0.1) do Round1Enemy.Torso.CFrame = Round1Enemy.Torso.CFrame * CFrame.new(-1, 0, 0) end end while wait(5) do Round1() end
Round1() has its own while wait() do loop. When you run Round1() on line 27 it will continue forever because the loop on lines 17 to 21 will never stop.