Script to position a part around a player's hand not working properly

I have a script which is inside a model that will be parented to the player’s character when joining using another script in ServerScriptService. The model is initially placed in ServerStorage so it does not run.

Here is the code inside the script that is parented under the model in ServerStorage:

local character = script.Parent.Parent
while true do
    wait(.5)
    Test = Instance.new("Part")
    Test.Name = "TestPart"
    Test.Size = Vector3.new(1,1,1)
    Test.Position = character.RightHand.CFrame.LookVector 
    Test.Parent = game.Workspace
    Test.Anchored = true
    Test.CanCollide = false
end

However, when I actually test it, the part appears very far away from the player and while it does change in position as the player moves, it’s change in position is very small as compared to the distance travelled by the player’s character. Is there something I am doing wrong?

LookVector doesn’t give a position, it gives a unit vector.

To place the CFrame you would do CFrame.new(position, position + lookVector). also you would just do .CFrame and it would save rotation of the other part.

1 Like

Why didn’t I think of that! The LookVector did appear to only point around a sphere. Thanks for clearing my misconception.

1 Like