|
| 12 Mar 2016 05:13 PM |
| You know those games without any tools or anything and you just click stuff to interact with it, I want to make something like that where I can click stuff and it gets the player but I want to do it without click detectors and I want a GUI to show up on what I am hovering over, I know I am bad at explaining things but you know on like a survival game it says "Click to pick up"..Generic Item Name. I am not asking you to make the entire script even though that would be nice I just need some pointers and stuff. Thanks! |
|
|
| Report Abuse |
|
|
SourHaze
|
  |
| Joined: 15 Dec 2008 |
| Total Posts: 588 |
|
|
| 12 Mar 2016 05:16 PM |
The mouse has a "hit" property that refers to the object the mouse is hovering over. So just listen for the Button1Down event and find out what mouse.hit is.
|
|
|
| Report Abuse |
|
|
|
| 12 Mar 2016 05:23 PM |
| mouse.Move and mouse.Target |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Mar 2016 06:46 PM |
| but how would I make a gui pop up over the item which I am hovering over and follow the mouse while its over the object? |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2016 07:19 PM |
| Change the position to Mouse.X, Mouse.Y if it's over an object. |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2016 07:41 PM |
alright, and if I wanted to make sure I am close to the object before i can interact will this work? if (mouse.Target.Position).magnitude < Range then |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 12 Mar 2016 07:51 PM |
Try this snippet: if (mouse.Target.Position - player.Character.Torso.Position).magnitude < Range then
If you only use magnitude on its own, it will give you the distance from the position (0,0,0), which probably isn't what you want. |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2016 08:01 PM |
| Alright thanks I got everything working but one thing is left, how can I tell that when the mouse is over a target that it clicks? This is the final piece, thanks a ton. |
|
|
| Report Abuse |
|
|
| |
|