Aggro script doesnt move to enemy, Can't find a good aggro script

I have a simple aggro script which should do what I want it to do as I don’t want anything too complex but something that works but it doesn’t seem to work at all, it only looks at the player and doesnt move to them.

This is the aggro script in the enemy :

task.wait(0.01)
local enemy = script.Parent
local boss = script.Parent:WaitForChild("Boss")

while boss.Health >= 1 do
	local Players = game.Players:GetPlayers()
	local TargetInfo = {nil,10000}
	for i = 1,#Players do
		local Dist = (Players[i].Character:WaitForChild("HumanoidRootPart").Position - boss.Parent:WaitForChild("HumanoidRootPart").Position).magnitude
		if Dist < TargetInfo[2] then
			TargetInfo = {Players[i],Dist}
		end
	end
	boss:MoveTo(TargetInfo[1].Character:WaitForChild("HumanoidRootPart").Position)
	enemy:SetPrimaryPartCFrame(CFrame.new(enemy.PrimaryPart.Position, TargetInfo[1].Character:WaitForChild("HumanoidRootPart").Position))
	task.wait()
end

I have no clue why it doesn’t work as previously it did the setcframe is that so it looks at the enemy and the moveto should make it move to the enemy but it doesn’t so help would be greatly appreciated thank you!