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

How can i know if a player is aiming to a block?

Asked by 5 years ago
Edited 5 years ago

Tittle says it all. Can anyone help? (i'm not asking code)

0
Can you be more specific? What do you mean by "Pointing"? fredfishy 833 — 5y
0
If a player uses their mouse and aim to a block a gui appears, i just have to know where i can learn. User#27525 1 — 5y
0
Changed to aiming instead of pointing. User#27525 1 — 5y
0
To get the mouse position, you need to do this local position = mouse.Hit.p. That should according to the wiki, retrieve a 3d position of the mouse. https://developer.roblox.com/api-reference/property/Mouse/Hit beeswithstingerss 41 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

local mouse = Player.GetMouse()

mouse.Target

Note that for player you must define player...

mouse.Target will get what object that the mouse is pointing at, try printing it!

0
oh and it's a colon inbetween player and getmouse(), ex - Player:GetMouse() sorry spearmint123 20 — 5y
0
Oh thanks User#27525 1 — 5y
0
I'll check out if it works. If true, i'll acept answer. User#27525 1 — 5y
Ad

Answer this question