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

How to find a vector from a screen position?

Asked by
sheepposu 561 Moderation Voter
4 years ago

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!

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 Shawnyg 4330 — 4y
0
No, the crosshair is just two frames that sit in a constant position. It's for console users sheepposu 561 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
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.

0
I appreciate the help... but you might want to read the comments above on my question sheepposu 561 — 4y
0
so what? Igoralexeymarengobr 365 — 4y
Ad

Answer this question