How to calculate the position?


How to make this gray thing go to yellow character like this:

I’m did the script and this works, but it appears inside the yellow character and I know why, but I don’t know how to calculate so that even when the character rotate, it looks right.
my script

workspace.Review.Position = workspace.Dummy1.PrimaryPart.Position 
workspace.Review.Orientation = Vector3.new(90, 0, 0) + workspace.Dummy1.PrimaryPart.Orientation

Try if this does something useful

workspace.Review.CFrame = workspace.Dummy1.PrimaryPart.CFrame
workspace.Review.Anchored = false
local weld = Instance.new("WeldConstraint")
weld.Part0 = workspace.Review
weld.Part1 = workspace.Dummy1.PrimaryPart
weld.Parent = workspace.Review

This is will not work, i’m just trying to make gray thing to appear in the correct position in which I showed in the screenshot, that is, so that even if the player turned, it turned exactly in the direction the player is looking at (the player is a yellow thing)

That is, so that it is not so confusing, I will explain with an example: the player presses a certain key and this gray thing appears (let’s call it the viewing angle) and this viewing angle should be set exactly in front of the player. If the orientation of the player was exactly Vector3.new(0,0,0), then I would add it to the script: workspace.Review.Position = workspace.Dummy1.PrimaryPart.Position + Vector3.new(0,0,20) and then it would appear exactly in front of my eyes and there I would add Weld, but when the player is turned in the other direction, it would work incorrectly and the whole idea of this would break.

I figured it out a long time ago, but I forgot to make a post about it

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