|
| 12 Feb 2014 05:00 PM |
You know how on GUIs, you can do: script.Parent.MouseEnter:connect(function() end) and: script.Parent.MouseLeave:connect(function() end)
How would you do this to a brick? I'll take wiki links, short explanations, or simply the code I need.
Thanks! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 12 Feb 2014 05:09 PM |
Found it within 10 seconds, don't see why you couldn't especially when there was a direct link from the 2D MouseEnter Wiki page to the 3D MouseEnter event.
http://wiki.roblox.com/index.php?title=MouseEnter_(Event)/3D |
|
|
| Report Abuse |
|
|
K1D4
|
  |
| Joined: 13 Jun 2013 |
| Total Posts: 10006 |
|
| |
|
|
| 12 Feb 2014 05:12 PM |
MouseEnter won't wotk for this, it's used for handles/archandles.
1. Get the player 2. Get the mouse 3. Get mouse.Target 4. See if mouse.Target is brick
Use local script for this |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:19 PM |
So like:
gui = game.Lighting.Gui plr = game.Players.LocalPlayer
function name() plr:GetMouse() if plr.Target:findFirstChild("Allow") then clone = gui:Clone() clone.Parent = plr.PlayerGui end end
name() |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:21 PM |
Whoops, I meant:
gui = game.Lighting.Gui plr = game.Players.LocalPlayer
function name() mouse = plr:GetMouse() if mouse.Target:findFirstChild("Allow") then clone = gui:Clone() clone.Parent = plr.PlayerGui clone.TextLabel.Text = mouse.Target.Name end end
name() |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:23 PM |
Wrong.
gui = game.Lighting.Gui plr = game.Players.LocalPlayer mouse = plr:GetMouse() brick = nil --replace brick with brick
mouse.Changed:connect(function(property) if property == "Target" then if mouse.Target == brick then --do stuff end end end)
|
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:24 PM |
| The second post is close but not quite right. |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:28 PM |
What if I want the GUI to appear on multiple bricks?
gui = game.Lighting.Gui plr = game.Players.LocalPlayer mouse = plr:GetMouse() --brick = nil --replace brick with brick
mouse.Changed:connect(function(property) if property == "Target" then if mouse.Target:findFirstChild("Allow") then clone = gui:Clone() clone.Parent = plr.PlayerGui clone.TextLabel.Text = mouse.Target.Name end end end) |
|
|
| Report Abuse |
|
|
| |
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 12 Feb 2014 05:35 PM |
| You've also got this inside a hopperbin right? |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:37 PM |
| No, it is a local script in workspace. |
|
|
| Report Abuse |
|
|
opplo
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 5320 |
|
|
| 12 Feb 2014 05:40 PM |
| From my understanding it would need to be a local script inside a hopperbin. But I might very well be wrong since I've seen it done before all be it rarely but without tools. |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:41 PM |
| I don't want to use a tool. I just remembered, this is used at Apocalypse Rising, I think. |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 05:45 PM |
More replies? )';
gui = plr.PlayerGui.Gui plr = game.Players.LocalPlayer mouse = plr:GetMouse() --brick = nil --replace brick with brick
mouse.Changed:connect(function(property) if property == "Target" then if mouse.Target:findFirstChild("Allow") then clone.TextLabel.Text = mouse.Target.Name end end end)
Would this work? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Feb 2014 05:56 PM |
Get the player's Mosue and use the Move move event, and check if there is a Target.
Example: (assuming everything is defined)
mouse.Move:connect(function() print("Part Selected:", mouse.Target.Name or "None") end) |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 06:07 PM |
plr = game.Players.LocalPlayer mouse = plr:GetMouse()
mouse.Move:connect(function() print("Part Selected:", mouse.Target.Name or "None") end) |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2014 06:10 PM |
| I'll just do it with a hopperbin. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 12 Feb 2014 06:20 PM |
gui = game.Lighting.Gui plr = game.Players.LocalPlayer mouse = plr:GetMouse()
mouse.Changed:connect(function(property) if property == "Target" then if mouse.Target.Name == "Part" then c = gui.Clone() c.Parent = plr.PlayerGui c.TextLabel.Text = mouse.Target.Name end end end) |
|
|
| Report Abuse |
|
|