# How to make a part's front & position face the player regardless of the player's rotation

So, this is going to be a ruff one - so I’ll try to explain it my best.

Basically, I’ve been trying to make a tool that, upon clicking once, creates bricks that are facing the player on a specific distance, but their positions adjust depending on the player’s rotation & spot that they’re standing at.

By this, I’m not talking about constant tracking - I’m talking about one click that updates the points.
Here’s an image reference below:

It’s easy making the parts face the player, but I can’t seem to figure out how I could achieve this.
Clearly, the first thing that comes to my mind is Vector3, but it always acts awkwardly when I try applying it to my scripts.

Does anyone have any methods on how this could be achieved?
Thanks!

4 Likes

Use LookVector with CFrame

``````-- this would take the part's position and add 5 studs in front of the part
local pos = HumanoidRootPart.CFrame + HumanoidRootPart.CFrame.LookVector*5
part.CFrame = CFrame.new(pos,HumanoidRootPart.Position)
``````
8 Likes

Wait so, LookVector applies to both position and rotation?

Nope lookvector is rotation and position if you set your lookvector to a part and then rotate the part magic will happen

3 Likes

Alright, I’ll give it a go and see how it goes.

2 Likes

So, I’ve tried using 2sgo’s method and the second line returns as nil.
What could I do? I’m experimenting with 2 parts for now.

My mistake, here’s the fixed line.

``````local pos = HumanoidRootPart.Position+ HumanoidRootPart.CFrame.LookVector*5
part.CFrame = CFrame.new(pos,HumanoidRootPart.Position)
``````

(I put CFrame instead of position)

2 Likes

So, here’s what happens now.

Although it works, how do I get it to perfectly rotate? (the part on the front is used for pos, the straight part behind is the part adjusted by the script)

From the screenshot, it appears to me that you’re asking for a way to make the bricks’ positions/rotations stay the same relative to something else, e.g. you click to place a part somewhere in front of the player; when the player moves or rotates, the part stays in front of the player at the same distance as before.
This can be done with a weld.

If this isn’t what you meant, don’t be afraid to clarify! Most of the frustration in the devforum comes from people asking poor questions and others immediately answering the wrong question.

1 Like

So, my plan is to make camera sequences for a player’s tool that don’t only depend on 1 specific spot to get the shot.

I’m trying to figure out a way on how I can make specific parts distanced & rotated towards the character, but stay relative if a player changes the position upon reusing the tool (not constant).

Although 2sgo’s method is helpful for cutscenes operating from the front (thanks once more for that), I’m trying to figure out how to pull this off and find helpful methods.

It’s totally fine! Yeah, it’s very hard explaining my own vision to someone else when they’re not aware of what I’m trying to pull.

Truly, to do this right, you need to understand CFrames. CFrames have ways to convert other CFrames from absolute space (defined by a part’s current Position and LookVector) to relative space (an offset from another CFrame, both in terms of rotation AND position).

In your case, you will want to use these (or their equivalents)

This will allow you to store your parts’ CFrames relative to the selected player by converting to object space, and then keep them that way by converting back to world space when the player moves.

2 Likes

How is the position of the brick from the player determined? The post is very vague and the wording is confusing. Like for example, do you want the position to be fixed in relation to the front surface of the character, if so you can easily save a offset cframe then apply it to the root part’s CFrame, because CFrames respect the local position and orientation.

i know its been 3 years, insane but if you need help here it is

i found the solution with the help of @2sgo

``````	local HumanoidRootPart = char:WaitForChild("HumanoidRootPart")

local pos = HumanoidRootPart.CFrame + HumanoidRootPart.CFrame.LookVector*5
part.CFrame = pos

``````