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

How to find a vector from a screen position?

I made a crosshair GUI and now I want to find the Vector that the crosshair is pointing at. The crosshair's position is constant. Thx in advance for any help!

2 comments

0

Well if the crosshair is the mouse at all times, have a look through the properties: https://developer.roblox.com/en-us/api-reference/class/Mouse

0

No, the crosshair is just two frames that sit in a constant position. It's for console users

1 answer

local plr = game:GetService("Players").LocalPlayer
mouse = plr:GetMouse()
print(mouse.Hit.p) -- gets the Vector position of the mouse in 3d space, .p is for getting Vector3, because .Hit only gets CFrame.

remember, this is a local script.

2 comments

0

I appreciate the help... but you might want to read the comments above on my question

0

so what?

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