Hello, i’m trying to make the little red part get on the same position of the mouse cursor by translating it into a Vector3 but I really cannot figure out how. The best I got is making it move slightly towards the mouse but I can’t seem to progress any more.
-- all this is wrapped in a RenderStepped event
local PositionOnScreen = UserInputService:GetMouseLocation();
local ViewportMouseRay = CurrentCamera:ViewportPointToRay(PositionOnScreen.X, PositionOnScreen.Y);
local RealDirection = Vector3.new(0, ViewportMouseRay.Direction.Y, ViewportMouseRay.Direction.Z);
HitPoint = ViewportMouseRay.Origin + RealDirection;
HitPoint = Vector3.new(0, HitPoint.Y, HitPoint.Z);
Part.Position = HitPoint;