Grid movement system not working, moving back and forth endlessly

Im making a grid like movement system, like the Game Clue, you click a square and you move to it, but for some reason it will sometimes make you walk the opposite direction and then make you walk in a back and forth motion

Ive been checking the Output and there a re no errors, i also printed the Plates Position and the player plates positiob and it wouldnt line up with how the code worked for some reason

local plr = game:GetService("Players").LocalPlayer
local Controls = require(plr.PlayerScripts.PlayerModule):GetControls()

Controls:Disable()

local debounce = false

local mouse = plr:GetMouse()
mouse.Button1Down:Connect(function()
	if mouse.Target ~= nil then
		if mouse.Target.Parent.Name == "Steps" and debounce == false then
			debounce = true
			local plate = mouse.Target
			local PlateXY = string.split(plate.Name, "|")
			repeat
				print("First")
				if PlateXY[1] > string.split(plr.Plate.Value.Name, "|")[1] then
					local plrxy = string.split(plr.Plate.Value.Name, "|")
					local platetoland = game.Workspace.Board.Steps[(plrxy[1]+1).."|"..(plrxy[2])]
					plr.Character.Humanoid:MoveTo(platetoland.Position)
					plr.Plate.Value = platetoland
					plr.Character.Humanoid.MoveToFinished:Wait()
				elseif PlateXY[1] < string.split(plr.Plate.Value.Name, "|")[1] then
					local plrxy = string.split(plr.Plate.Value.Name, "|")
					local platetoland = game.Workspace.Board.Steps[(plrxy[1]-1).."|"..(plrxy[2])]
					plr.Character.Humanoid:MoveTo(platetoland.Position)
					plr.Plate.Value = platetoland
					plr.Character.Humanoid.MoveToFinished:Wait()
				elseif PlateXY[1] == string.split(plr.Plate.Value.Name, "|")[1] then
					if PlateXY[2] > string.split(plr.Plate.Value.Name, "|")[2] then
						local plrxy = string.split(plr.Plate.Value.Name, "|")
						local platetoland = game.Workspace.Board.Steps[(plrxy[1]).."|"..(plrxy[2]+1)]
						plr.Character.Humanoid:MoveTo(platetoland.Position)
						plr.Plate.Value = platetoland
						plr.Character.Humanoid.MoveToFinished:Wait()
					elseif PlateXY[2] < string.split(plr.Plate.Value.Name, "|")[2] then
						local plrxy = string.split(plr.Plate.Value.Name, "|")
						local platetoland = game.Workspace.Board.Steps[(plrxy[1]).."|"..(plrxy[2]-1)]
						plr.Character.Humanoid:MoveTo(platetoland.Position)
						plr.Plate.Value = platetoland
						plr.Character.Humanoid.MoveToFinished:Wait()
					end
				end
				print(string.split(plr.Plate.Value.Name, "|"), PlateXY)
				print("Passed")
			until string.split(plr.Plate.Value.Name, "|")[1] == PlateXY[1] and string.split(plr.Plate.Value.Name, "|")[2] == PlateXY[2]
			print("Okay")
			debounce = false
		end
	end
end)

https://i.gyazo.com/68e81e14abab4af89edbe7e31c238929.mp4