How to make a radius/aim assist for mouse target?

I’m making a grapple hook parkour game and when swinging around, especially when speeding up, it can get kinda hectic and hard to aim. my max grapple distance is also 100, if the distance between my hook and handle is bigger than that, nothing happens. but i want to change that to get whatever part is closest to the center of my cursor on my screen that is within 100 studs, and hook onto that, but i don’t know if something like that is possible.
the other option i have is maybe putting proximity prompts nearby to hook on to, but at really fast speeds when you’re moving far distances, it’d be quite impractical, as their range would have to be really big and it’d get in the way of slower players. also it’s just kinda cheesy.
so i’m wondering how i can implement some sort of aim assist onto parts with this. also the “hook” portion of my grapple hook is just an attachment, it can go anywhere on a part, it’s not limited.

You use dot products for that!

local endPoint = -- Your grapple end point that the player SHOULD grapple to. Could also be predicted with sphereCasts.

local camera = workspace.CurrentCamera

local dot = camera.LookVector:Dot(endPoint-camera.CFrame.Position)
if math.acos(dot) < math.rad(10) --[[10 degrees]] then
    grapplePoint = endPoint
end

would that return whatever is closest to me and the center of my cursor? i’ve used raycast before but not spherecast, but if it works the same way, i’m assuming it returns the position from right where it first touched something

Yes, SphereCasts are basically 3d while raycasts are 1d. SphereCasts would be a better option for this.

honestly, i haven’t had much luck using the spherecast. this is what im using to get the mouse position and target:
local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Button1Down:Connect(function()
if keybindsEnabled then
local target = mouse.Target
local mousePosition = mouse.Hit.Position
inputkey:FireServer(“MouseDown”, mousePosition, target, autoRetract)
end
end)

Hmm, you can use this:

To achieve something like this:

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        local mousePosition = UserInputService:GetMouseLocation()
        local rayInfo = workspace.CurrentCamera:ScreenPointToRay(mousePosition.X,mousePosition.Y)
        local ray = workspace:SphereCast(rayInfo.Origin,5,rayInfo.Direction*100,rayCastParams)
-- Now you can use this ray to see a part where you can grapple to.
    end
end)