Hey, i got a question, what do i need to use in order to fix the script from down below. I want to spawn a dummy clone every 3 second but the for i,v pairs stops me and spawns another dummy only after the first one is done.
-- Services --
local ServerStorage = game:GetService("ServerStorage")
local PathfindingService = game:GetService('PathfindingService')
local replicatedStorage = game:GetService('ReplicatedStorage')
-- Variables --
local IntValuesFolder = replicatedStorage:WaitForChild('IntValues')
local EnemiesFolder = ServerStorage:WaitForChild('Enemies')
local WaveNumber = IntValuesFolder:WaitForChild('Wave')
-- Actual Coding --
while true do
wait(3)
local clonedEnemy = EnemiesFolder.Attacker:Clone()
clonedEnemy.Parent = game.Workspace
clonedEnemy.HumanoidRootPart.CFrame = game.Workspace.EnemySpawn.CFrame + Vector3.new(0,2,0)
clonedEnemy.Humanoid.WalkSpeed = 5
local path = PathfindingService:CreatePath()
path:ComputeAsync(clonedEnemy.HumanoidRootPart.Position, game.Workspace.EndLocation.Position)
local wps = path:GetWaypoints()
for i, wp in pairs(wps) do
clonedEnemy.Humanoid:MoveTo(wp.Position)
clonedEnemy.Humanoid.MoveToFinished:Wait(1)
end
end

1 comment
could you be more specific about what you're trying to do? I'm confused by the wording.