Repeat not working

Hey Everyone,
I’m making a repeat for my story game’s boss fight. It’s supposed to attack the player in the same way until the NPC Is dead.
This is my script:

	repeat
	
		wait(.5)
		
		game.ReplicatedStorage.Events.SendLava:FireAllClients()
		
		wait(10)
		
		for _, Tim in pairs(game.ServerStorage.TimClones:GetChildren()) do
			spawn(function()
				local PlayerToGoTo = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
				if not PlayerToGoTo.Character or not PlayerToGoTo.Character.HumanoidRootPart then
					return
				end
				Tim.Parent = game.Workspace
				Tim.HumanoidRootPart.CFrame = PlayerToGoTo.Character.HumanoidRootPart.CFrame + Vector3.new(0,5,0)
			end)
		end
		
		wait(10)
		
		game.Workspace.LavaStart.CFrame = CFrame.new(389.635101, 22648.0625, -419.175079)
		
		for _, Tim in pairs(game.Workspace:GetChildren()) do
			if Tim:IsA('Model') and Tim:FindFirstChild('Zombie') and Tim.Name == 'Monster' then
				Tim:Destroy()
			end
		end
			
		wait(1)
		
	until game.Workspace.BossBattle.TimHead.Tim.Humanoid.Health == 0

The problem is, is that it only works once; It doesn’t repeat. I do not understand why. There are no errors. Thank you for any help!

The humanoid’s health isn’t 0.

Well thats cuz repeat isnt used like that. Repeat is like a condition base thing.

like

repeat wait() until plr.Character

< What you wanna use is probably a while loop and then add conditions to stop it.

I mean correction you can use things in between, its just not a preferred method for what you’re doing. I know I might of worded that weirdly

Yes, But it’s only working once. It’s not repeating.

Have you tried troubleshooting at all > i.e changing the condition and adding prints to see if it breaks anywhere

I tried this:

	local Courountine = coroutine.wrap(function()
	while game.Workspace.BossBattle.TimHead.Tim.Humanoid.Health > 0 do
	
		wait(.5)
		
		game.ReplicatedStorage.Events.SendLava:FireAllClients()
		
		wait(10)
		
		for _, Tim in pairs(game.ServerStorage.TimClones:GetChildren()) do
			spawn(function()
				local PlayerToGoTo = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
				if not PlayerToGoTo.Character or not PlayerToGoTo.Character.HumanoidRootPart then
					return
				end
				Tim.Parent = game.Workspace
				Tim.HumanoidRootPart.CFrame = PlayerToGoTo.Character.HumanoidRootPart.CFrame + Vector3.new(0,5,0)
			end)
		end
		
		wait(10)
		
		game.Workspace.LavaStart.CFrame = CFrame.new(389.635101, 22648.0625, -419.175079)
		
		for _, Tim in pairs(game.Workspace:GetChildren()) do
			if Tim:IsA('Model') and Tim:FindFirstChild('Zombie') and Tim.Name == 'Monster' then
				Tim:Destroy()
			end
		end
			
		wait(1)
		
		end
	end)
	
	Courountine()
	
	repeat wait() until game.Workspace.BossBattle.TimHead.Tim.Humanoid.Health == 0

and It only works once. The thing i did after the repeat wait doesn’t play.

I’ve got a local script aswell, which makes the lasers move. This is it:

-- Variables
Player = game.Players.LocalPlayer

-- Services
ReplicatedStorage = game:GetService('ReplicatedStorage')
Events = ReplicatedStorage:WaitForChild('Events')
TweeningService = game:GetService('TweenService')

Events.SendLava.OnClientEvent:Connect(function()
	local TweeningInfo = TweenInfo.new(7,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0)
	local TweeningGoal = {CFrame = game.Workspace.LavaEnd.CFrame}
	local Animation = TweeningService:Create(game.Workspace.LavaStart,TweeningInfo,TweeningGoal)
	Animation:Play()
end)

Sometimes scripts are just confusing. I also have a problem where mine doesnt work and there are no errors. Maybe u could just watch a tutorial on how to make a boss fight or just ask @Merely for help. I heard he is really good at scripting. Im not sure if he has his DMs on tho.

I don’t think watching a tutorial will help me, I’m making a custom one so…

you script already looks too complicated for me I dont even know that much about scripting

I tried doing this:

while game.Workspace.BossBattle.TimHead.Tim.Humanoid.Health >= 0 do
	
	wait(10)
	
	game.ReplicatedStorage.Events.SendLava:FireAllClients()
		
	wait(10)
		
	for _, Tim in pairs(game.ServerStorage.TimClones:GetChildren()) do

		local PlayerToGoTo = game.Players:GetChildren()[math.random(1,#game.Players:GetChildren())]
		Tim.Parent = game.Workspace
		Tim.HumanoidRootPart.CFrame = PlayerToGoTo.Character.HumanoidRootPart.CFrame + Vector3.new(0,5,0)
	end
		
	wait(10) 
		
	game.Workspace.LavaStart.CFrame = CFrame.new(389.635101, 22648.0625, -419.175079)
		
		
	print('Hi!')
		
	for _, Tim in pairs(game.Workspace:GetChildren()) do
		if Tim:IsA('Model') and Tim:FindFirstChild('Zombie') and Tim.Name == 'Monster' then
			Tim:Destroy()
		end
	end
			
		
end

and Hi prints endlessly, but nothing else repeats. Please could you help me?