Issues with LookVector

Hey DevForum. I’ve been having this issue lately with LookVector. My current script places two attachments in the PrimaryPart of the character model, with one being 10 studs in front of said PrimaryPart. However, depending on the character’s LookVector, the attachment will be placed in front of or behind the character. This is what it looks like:

At first, I used cf.LookVector*10, which caused the attachments to appear around the player in a circle if the keybind was pressed enough. I changed it to cf.LookVector *,0,10), and the above image was the result. Here’s the current code:

local function tele(plr)
	local root = plr.Character.PrimaryPart
	local look = root.CFrame.LookVector *,0,10)
	local a1,a2 ="Attachment",root),"Attachment",root)
	a2.Position = look

Any advice would be much appreciated!

I’m not exactly sure what you’re trying to do. Could you explain a little better?

My goal is to create a beam between the PrimaryPart of the character model and the point 10 studs in front of it. But, I have to get the attachments there first. The first attachment stays in the root, and the second is supposed to go 10 studs in front. Obviously, that’s not the case :sweat_smile:

An attachments position is already relative to the parent part’s lookVector iirc. Just set the position to like,0,0)


You’re right, that worked. Thank you.

@KeysOfFate is right. If you were trying to position a part like that, then you’d need to give the part the position of the HumanoidRootPart’s position plus it’s LookVector*10. But Attachments are already positioned relative to the player. There’s a position property in attachments to offset the attachment from the center of the parent part.