It's kind of irritating that the UserInputService doesn't have a way to give 3D position. MouseMovement > Position returns the pixel-based screen coordinates (as a Vector3:
[X, Y, 0]).
The script, which runs locally, uses that 2D coordinate to get the mouse's position via the Camera's
ScreenPointToRay method. If you have something else that works feel free to post it.
local Players = game:GetService("Players")
local Camera = workspace.CurrentCamera
function GetMousePoint(X, Y)
local RayMag1 = Camera:ScreenPointToRay(X, Y) --Hence the var name, the magnitude of this is 1.
local NewRay = Ray.new(RayMag1.Origin, RayMag1.Direction * 1000)
local Target, Position = workspace:FindPartOnRay(NewRay, Players.LocalPlayer.Character)
--Listen to UserInputService "MouseMovement", and get the
--Position property of the InputObject. Pass in X, Y to the
--function and get the 3D world position.