generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: On Hover Brick

Previous Thread :: Next Thread 
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 05:01 PM
Bump.
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 05:07 PM
Bump
Report Abuse
opplo is not online. 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 is not online. K1D4
Joined: 13 Jun 2013
Total Posts: 10006
12 Feb 2014 05:11 PM
Maybe he was tired. durr
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
12 Feb 2014 05:24 PM
The second post is close but not quite right.
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 05:33 PM
Bump
Report Abuse
opplo is not online. 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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 05:37 PM
No, it is a local script in workspace.
Report Abuse
opplo is not online. 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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 05:49 PM
BUMP
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 05:52 PM
BUMP..
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 05:55 PM
Bump/
Report Abuse
cntkillme is not online. 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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
12 Feb 2014 06:10 PM
I'll just do it with a hopperbin.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
12 Feb 2014 06:10 PM
No, you did it fine
Report Abuse
COOLDUDE11OO is not online. COOLDUDE11OO
Joined: 21 Aug 2011
Total Posts: 5115
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image