How do i properly put a part infront of the player

I’m trying to set a block infront of the player, I’m currently using LookVector and multiplying it with a Vector3 to move it abit further, problem is, it never works.

image

It’s always either to the right or left and not in the center
Here’s what the code for placing it is by the way…

Cloned.CFrame = plr.Character.Torso.CFrame + (plr.Character.Torso.CFrame.LookVector * Vector3.new(2, 1, 1))

You are adding a Vector3 to a CFrame. This is going to offset the CFrame’s coordinates in World Space by the Vector3 you’re providing. You could make it much simpler by offseting the coordinates in Local Space, which means relative to the torso itself, by multiplying it with another CFrame instead:

Cloned.CFrame = plr.Character.Torso.CFrame * CFrame.new(-2, -1, -1)

It kind of works but its still all over the place (as in its behind the player and i cant get it out of there)

I would use welds to weld the player torso and the part since it does all the math for you

Does messing with the X, Y or Z properties of the CFrame.new(-2, -1, -1) do anything?

Otherwise, what @urgentnotice has suggested should also work fairly well.

uh update:
Multiplying by 0 works for some reason (even though it should set it to the 0 coordinates)

Multiplying a CFrame with another CFrame adds their two coordinates together (relative to the first CFrame’s local space), not multiply them.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.