I have a problem with an enemy I am making

Hi, I am making a summoner enemy in a game, I have just a couple problems with the script I made for the summoning.

I am trying to have it stand still while it summons enemies, but for some reason it stops for a second and then it walks as the enemies spawn in front of it, I tried to change the wait times, but that didn’t work and I do not know what to do about it.

The script works, it just doesn’t work properly. I want to have the summoner enemy stop walking until it stops spawning enemies, then chases the player again.

local amount = math.random(4,7)
local spawnPart = script.Parent.SummonZone
local zombieTypes = {game.ServerStorage.Enemies["Darkheart Puppet"]}
local timeToWait = 0.8
local canspawn = true

while true do
	wait(math.random(10,20))
	script.Parent.Zombanoid.WalkSpeed = 0
	wait(3)
	spawnPart.Fire.Enabled = true
	wait(3)
	for i = 1,amount,1 do
		local Zombie = zombieTypes[math.random(1, #zombieTypes)]:Clone()
		Zombie.Parent = workspace
		Zombie:SetPrimaryPartCFrame(spawnPart.CFrame * CFrame.new(Vector3.new(0,4,0)))
		wait(timeToWait)
	end
	wait(4)
	script.Parent.Zombanoid.WalkSpeed = 11
end
end