How to get the world position of a players mouse?

I have tried to get position of the mouse by doing:

local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Button1Down:Connect(function()
    print(mouse.Target.Position)
end)

but it it doesn’t print where the mouse is pointing and only prints the target of the mouse’s position. Is there a way to get the world position of the mouse?

1 Like

You should be using Mouse.Hit to get the position of the mouse to world space.

As a learning point, consider Mouse.Target as a quick way to locate the part in the Explorer. When you call Mouse.Target.Position you are reading the position property of the part the mouse is “touching”.

5 Likes

alright ill try it in a second thanks.

The link @xZylter posted is a great resource in general when you have questions like this.

Type “Mouse” in the search bar at the top of that page and click the first result. You will see all the properties and methods on the Mouse object.

1 Like