Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get the mouse's position?

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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;
0
CFrame.p is not a function; It doesn't return anything. creeperhunter76 554 — 6y
0
When I said CFrame.p I meant part.CFrame.p plasma_node 343 — 6y
Ad

Answer this question