Part rotation based on player rotation

greetings! to visualize this example, i have a this picture (sorry for bad quality)
IMG_20230117_230409

So, i have this part, in which the sharp point (refer as SIDE A), and two sharp points ( refer as SIDE B).

What I want to do is I want SIDE A to point out of the player, and SIDE B to point in to the player.
Like this:


However, I simply don’t know how. It kept spawning facing in one direction (see picture 1).
Thank you in advance for helping me!
I will leave you with my script(serverscript)

Shard.Orientation = Vector3.new(0,player.Character.HumanoidRootPart.CFrame.LookVector,90) --90 so that the part wouldn't go upside down
--my problem is at Y axis, since it was the axis that changes the facing direction

You might try using the Roblox Tools system to do this. When the tool is equipped, it will automatically be welded to the player using a grip that you can define as being directly in front.

Here’s a couple of links for some Tools info:
Creating Player Tools
In-Experience Tools

HTH!

So you want this object to point to the player at all times? Or have the same orientation as the player?

One thing I noticed about your script, is that you’re setting the Orientation, which is expressed in radians, using a value of 90, which is in degrees. Maybe try using math.pi instead. And actually, I think Orientation is not settable, as it’s a sub-property of the part’s CFrame.

Maybe try something like:

-- a cframe 3 studs in front of the character
local ShardCF = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -3)
-- fix the shard's orientation
Shard.CFrame = ShardCF * CFrame.fromOrientation(math.pi/2, 0, 0)

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