The tool basically creates an anchor where you click and it proceeds with other functionality and what not. The game I'm using this tool is most definitely requires the tool to work well with terrain. The problem is in the first few lines the code suggests a maximum distance from where an anchor can be created. However, when interacting with terrain this limit is essentially ignored as it can be manipulated to be placed much much further than this limit of "2".

This is the chunk from where I assume the problem is happening, while creating an "anchor"

TOOL.Equipped:connect(function(MOUSE)
    INSTRUCTIONS.Visible = false  --Shows the instructions GUI
	MOUSE.Button1Down:connect(function()
		 if LPLAYER:DistanceFromCharacter(UserMouse.Hit.p) > 2 then --Distance anchor can be made from
			print('Realistically you couldnt anchore yourself from that far.')
		 else
			if Anchor ~= nil then
				if WORKSPACE:FindFirstChild(Anchor.Name) ~= nil then
					print('Anchor point already exist, please remove current one.')
					return
				else
					local MTarget = MOUSE.Target
					if MTarget == nil then		
						NOTIFY:TweenPosition(UDim2.new(0.5,-113,0.5,-10), 'InOut', 'Quad', 1, false)
						wait(4)
						NOTIFY:TweenPosition(UDim2.new(0.5,-113,1.2,-10), 'InOut', 'Quad', 1, false)
						wait(4)
					elseif MTarget.Name == 'Terrain' then    --Anchor ignores the distance cap when placed on smooth terrain...			
						MouseTarget = MOUSE.Hit.p
						Anchor = CreateAnchor()
						Rope = CreateRope()	
					else
						MouseTarget = MOUSE.Target.Position
						Anchor = CreateAnchor()
						Rope = CreateRope()
					end
				end
			else
				local MTarget = MOUSE.Target
				if MTarget == nil then		
					NOTIFY:TweenPosition(UDim2.new(0.5,-113,0.5,-10), 'InOut', 'Quad', 1, false)
					wait(4)
					NOTIFY:TweenPosition(UDim2.new(0.5,-113,1.2,-10), 'InOut', 'Quad', 1, false)
					wait(4)
				elseif MTarget.Name == 'Terrain' then   --Anchor ignores the distance cap when placed on smooth terrain...
					MouseTarget = MOUSE.Hit.p
					Anchor = CreateAnchor()
					Rope = CreateRope()	
				else
					MouseTarget = MOUSE.Target.Position
					Anchor = CreateAnchor()
					Rope = CreateRope()
				end
			end
		end
	end)