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

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

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

4 comments

0

Can you be more specific? What do you mean by "Pointing"?

0

If a player uses their mouse and aim to a block a gui appears, i just have to know where i can learn.

0

Changed to aiming instead of pointing.

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

1 answer

✓ Accepted answer

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!

3 comments

0

oh and it's a colon inbetween player and getmouse(), ex - Player:GetMouse() sorry

0

Oh thanks

0

I'll check out if it works. If true, i'll acept answer.

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