Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to get the mouse's position?

I'M NOT ASKING FOR THE CFRAME WHICH IS BY USING ORIGIN OR USING HIT.

I would like to know how to get the mouse's position and not it's CFrame. Right now I'm doing this:

Target.Parent.main.CFrame = mouse.Hit

it rotates it too since I use the CFrame, please help me only use the position.

I'm trying to make a function that makes it so when you click an object it moves it, to the position of the mouse.

1 answer

✓ Accepted answer

part.CFrame.p will return a position. So if we get the position of mouse.Hit and wrap it in a rotationless CFrame, we get:

Target.Parent.main.CFrame = CFrame.new(mouse.Hit.p);

You could also set

Target.Parent.main.Position = mouse.Hit.p;

2 comments

0

CFrame.p is not a function; It doesn't return anything.

0

When I said CFrame.p I meant part.CFrame.p

This discussion is preserved as it was. New answers, comments, and votes are closed.