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 4 years ago
Edited 4 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 — 4y
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 — 4y
0
Changed to aiming instead of pointing. User#27525 1 — 4y
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 — 4y

1 answer

Log in to vote
1
Answered by 4 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 — 4y
0
Oh thanks User#27525 1 — 4y
0
I'll check out if it works. If true, i'll acept answer. User#27525 1 — 4y
Ad

Answer this question