Making the attachment follow the players mouse at a certain distance

not a big issue or error just me asking a question that how do i make the attachment follow the players mouse at a certain distance… now yall dont tell me to use Unit * 20 i did and it didnt worked…so please tell me a alternative

  1. Get the distance between mouse & character (or camera) aka what you want the attachment to follow.
  2. If the distance is bigger than MaxDistance then use the Unit * MaxDistance method
    Else use the current mouse position

Note, you might need to make a custom mouse raycast, so you can ignore specific objects like something you want to grab.

idk this method can u please send the code lol