UserInputService.InputBegan:connect(function(M)if M.KeyCode==Enum.KeyCode.S then CurrentPath=nil MouseHolding=false if PathingThread then coroutine.yield(PathingThread)end;(LocalCharacter:WaitForChild("\072\117\109\097\110\111\105\100")):MoveTo(LocalCharacter.HumanoidRootPart.Position)end end)LocalMouse.Button2Down:connect(function()MouseHolding=true repeat if PathingThread then coroutine.yield(PathingThread)end PathingThread=coroutine.resume(coroutine.create(function()CreatePath()end))print(1)wait(.05)until MouseHolding==false or CurrentPath==nil end)LocalMouse.Button2Up:connect(function()MouseHolding=false end)
------------------------------------------------------------------------------------------------------------------------------------------------------
--  Events
------------------------------------------------------------------------------------------------------------------------------------------------------

UserInputService.InputBegan:connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.S then
		CurrentPath = nil
		MouseHolding = false
		if PathingThread then
			coroutine.yield(PathingThread)
		end

		LocalCharacter:WaitForChild("Humanoid"):MoveTo(LocalCharacter.HumanoidRootPart.Position)
	end
end)

LocalMouse.Button2Down:connect(function()
	MouseHolding = true

	repeat --wait(0.05)
		if PathingThread then
			coroutine.yield(PathingThread)
		end

		PathingThread = coroutine.resume(coroutine.create(function()
			CreatePath()
		end))

		print(1)
		wait(0.05)
	until MouseHolding == false or CurrentPath == nil
end)

LocalMouse.Button2Up:connect(function()
	MouseHolding = false
end)
