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 * Vector3.new(0,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 * Vector3.new(0,0,10)
local a1,a2 = Instance.new("Attachment",root),Instance.new("Attachment",root)
a2.Position = look
end
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
@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.