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

Whats the difference between Mouse.Hit & Mouse.Target? [closed]

Asked by
yurhomi10 192
10 years ago

Having trouble understaning the differences between these two.

Closed as Primarily Opinion-Based by youtubemasterWOW and JesseSong

This question has been closed because it is a discussion about a topic focused on diverse opinions, which isn't a good fit for our Q&A format.

Why was this question closed?

2 answers

Log in to vote
8
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

mouse.Hit refers to the position that the mouse was touching. mouse.Target refers to the part that the mouse was hovering on.

While for many things mouse.Target.Position will be pretty close to mouse.Hit.p they are not the same position (for instance, on a baseplate, which is large, so its center is far from points on its surface).

If you are looking for the position of the mouse in the world, use mouse.Hit. If you care about what they are hovering over, use mouse.Target.

0
Thanks aswell!! yurhomi10 192 — 10y
Ad
Log in to vote
3
Answered by
Sublimus 992 Moderation Voter
10 years ago

Mouse.Hit returns the CFrame position of the mouse:

http://wiki.roblox.com/index.php?title=Hit_(Property)

Mouse.Target returns the part or object that the mouse is currently pointed at:

http://wiki.roblox.com/index.php?title=Target_(Property)/mouse

0
Thanks!! yurhomi10 192 — 10y
0
No problem! Sublimus 992 — 10y