Can't position LookVector to the TopSurface

(I am not sure what to name this topic)

So I have a part that rotates and I want another part (Marker) to constantly appear in front of the TopSurface of the first part.

But the thing is, the marker only appears in front of the FrontSurface and I am not sure how to change it.
Video: robloxapp-20210724-1406556_Trim.wmv (205.3 KB)

I tried messing around with the CFrame and Angles but failed. I also searched around but I couldn’t find anything related, unless I didn’t search good enough.

Here is my code:

while wait() do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(.08, 0, 0) -- Rotates the main part
	script.Parent.Parent.Marker.CFrame = script.Parent.CFrame + (script.Parent.CFrame.LookVector * 5) -- Positions the marker
end

Not sure I understand, do you want to like position the second part at the end of the first part or something?

local firstPartSize = script.Parent.Size
local markerSize = script.Parent.Parent.Marker.Size

script.Parent.Parent.Marker.CFrame = script.Parent.CFrame*CFrame.new(0, 0, (firstPartSize.Z/2) + (markerSize.Z))
1 Like

I wanted the second part to be constantly in front of the top side of the first part (No other side). but your code solved it, thank you.

1 Like