local function U(U,c)if c==0 then return end local I=c[1]:FindFirstChild("\067\104\101\099\107\112\111\105\110\116")local G=(U.Position-I.Position).magnitude local j=I for c,Q in ipairs(c)do I=Q:FindFirstChild("\067\104\101\099\107\112\111\105\110\116")local N=(U.Position-I.Position).magnitude if N<G then j=I end end U.CFrame=CFrame.new(U.Position,j.Position)end

local function UpdateDirection(arrow, targets)
	if targets == 0 then return end
	
	local checkpoint = targets[1]:FindFirstChild("Checkpoint")
	local closestDistance = (arrow.Position - checkpoint.Position).magnitude
	local closestTarget = checkpoint
	
	-- Find nearest target
	for _, target in ipairs(targets) do
		checkpoint = target:FindFirstChild("Checkpoint")
		local distance = (arrow.Position - checkpoint.Position).magnitude
		if distance < closestDistance then
			closestTarget = checkpoint
		end
	end
	
	-- Point arrow at nearest target
	arrow.CFrame = CFrame.new(arrow.Position, closestTarget.Position)
end -- UpdateDirection()