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: Getting A Mouse through a Gui?

Previous Thread :: Next Thread 
Sethalonian is not online. Sethalonian
Joined: 13 Jan 2010
Total Posts: 530
27 Jan 2012 12:11 PM
I am trying to make a frame gui appear in the mouse so that when you move the mouse, it moves with it. Is this possible without using a tool? If it is impossible is there another simple way to do it?
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
27 Jan 2012 12:34 PM
I'm pretty sure that there's a function for GUI objects to find out if the mouse hovers over.

MouseHover

or

MouseHovered

Not sure... Also, I could be wrong.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
27 Jan 2012 12:54 PM
GUI.MouseButton1Click:connect(function(Mouse)
--do stuff with 'Mouse'
end)
Report Abuse
Sethalonian is not online. Sethalonian
Joined: 13 Jan 2010
Total Posts: 530
27 Jan 2012 01:07 PM
So I would put the gui in the mouse? like gui.Parent = Mouse. Is that how It would work?
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
27 Jan 2012 01:08 PM
Oh, I think I know what you want. Gimme one sec.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
27 Jan 2012 01:15 PM
This will most likely have an issue, lemme know what it is.


GUI = script.Parent --Place the script inside of the GUI you want moved

on = false
GUI.MouseButton1Click:connect(function(Mouse)
if not on then
x,y = Mouse.X,Mouse.Y
rangeX,rangeY = x-GUI.AbsolutePosition.x,y-GUI.AbsolutePosition.y
on = true
Mouse.Moved:connect(function()
GUI.Position = UDim2.new(0,Mouse.X-rangeX, 0,Mouse.Y-rangeY)
end)
else
on = false
GUI.Position = UDim2.new(0,Mouse.X-rangeX, 0,Mouse.Y-rangeY)
end
end)
Report Abuse
Sethalonian is not online. Sethalonian
Joined: 13 Jan 2010
Total Posts: 530
27 Jan 2012 08:26 PM
So I could, do like a right click to activate the frame to move with the mouse?
Report Abuse
CrazyBananaMonkey is not online. CrazyBananaMonkey
Joined: 10 Nov 2009
Total Posts: 1599
27 Jan 2012 08:35 PM
That would be left click, change 'MouseButton1Down' to 'MouseButton2Down' for you to be able to right click.
Report Abuse
Sethalonian is not online. Sethalonian
Joined: 13 Jan 2010
Total Posts: 530
27 Jan 2012 08:37 PM
Well, yes, thats what I meant, but ok... Thank You.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
31 Jan 2012 03:29 PM
Why does everyone use MouseButton1Down, it's MouseButton1Click. Makes more sense, for clicking purposes at least.
Report Abuse
1WOOF1 is not online. 1WOOF1
Joined: 03 May 2009
Total Posts: 20682
31 Jan 2012 03:32 PM
[ Content Deleted ]
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
31 Jan 2012 03:35 PM
Herpaderp? If you want an function to be fired onGuiClicked, then why wouldn't you use MouseButton1Click instead of MouseButton1Down?
Report Abuse
agent767 is not online. agent767
Joined: 03 Nov 2008
Total Posts: 4181
31 Jan 2012 04:12 PM
@epicfail
because there is a MouseButton1Up-event
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
31 Jan 2012 04:48 PM
Yes, I know the events for a GUI. But I'm just trying to say, why wouldn't people use MouseButton1Click if they want the function to fire onClicked.
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