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

2 comments
How would i fix it then?
Replace it with a loop that waits for something like a "repeat until" or a loop with a certain amount of loops