Please try it out, I do not have access to gyazo and I have to upload everything to youtube. If you would please read the documentation of how it works, as well as try setting the parent before you set the world position, i’m sure we would have a much easier time.
You shouldn’t be using both rays and positioning with magnitude to be doing something as simple as what I did but if that is an acceptable solution then it’s fine I guess.
I’m confused, what is position for, did he want it relative to a humanoidrootpart and an object??
EDIT to below reply @xurmx: Did you want it to not go through the wall this whole time? I misread and thought you only wanted it relative to a humanoidrootpart. If you did, you would just fire a ray then and set the attachment at the end position. Use the character as an ignore descendants instance.
So basically, it gets the hit position, and it measures the distance between the humanoid root part and the hit point. Then it pushes it forward that amount of distance from the HRP.
Hidden’s solution actually used the ray end point which is way better and efficient and will always exactly make up for the distance between my player and the wall
It’s not “better and efficient” per say but that I misread and didn’t know you wanted it to not go through the wall. You just shoot a ray with a certain distance you want. You just multiply it by a given range.
If your title was exactly as what you wanted, my solution was the best for that problem.