AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 07:04 PM |
| Pretty simple, but how do you move like a textlabel to wherever you click? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 07:05 PM |
| TextLabel.Position = UDim2.new(0, mouse.X, 0, mouse.Y); |
|
|
| Report Abuse |
|
|
|
| 18 Feb 2015 07:06 PM |
mouse.Button1Down:connect(function() -- cnt's code end) |
|
|
| Report Abuse |
|
|
|
| 18 Feb 2015 07:07 PM |
mouse.Button1Down:connect(function() TextLabel.Position = UDim2.new(0, mouse.X-TextLabel.Size.Offset.X/2, 0, mouse.Y-TextLabel.Size.Offset.Y/2); end)
That will make it centered |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 07:09 PM |
| Well not really, you can have textlabels without a size so you would have to use TextBounds to be safe no? |
|
|
| Report Abuse |
|
|
|
| 18 Feb 2015 07:12 PM |
| if the text is centered wouldn't it still be centered? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 07:13 PM |
| TextLabels are (by default) from the top-left but you can change that to make it centered |
|
|
| Report Abuse |
|
|
|
| 18 Feb 2015 07:34 PM |
| I'm 99% sure they are defaulted to center. |
|
|
| Report Abuse |
|
|
|
| 18 Feb 2015 07:36 PM |
| @Joey They aren't defaulted to center. |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 07:38 PM |
The position is set to something like:
(740,0)(503,0)
which is far beyond the screen. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 07:54 PM |
| I honestly don't remember so I'm not gonna say for sure that they are centered by default. |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 07:56 PM |
| Mouse.X sets it depending on the screen size. How can I adjust this |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 07:57 PM |
| It doesn't matter, why would you need to adjust it? |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 07:58 PM |
| Like I said it sets the position to something like (500,0,500,0), which isn't even on the screen, and I don't have hardly any experience with gui. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 07:59 PM |
How would it do that, exactly? Mouse.X and Mouse.Y are the screen coordinates of the mouse, not the 3D coordinates like mouse.Hit.X and mouse.Hit.Y are. |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 08:00 PM |
I have a frame inside a TextButton. Once the textbutton is clicked, the frame is visible and is moved to the mouse coordinates.
I don't know how it'd work for others, but it's no where near the screen, and sets it to a high number. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 08:01 PM |
And look at my script again. I put them as the 2nd and 4th components of the UDim2, not the 1st and 3rd. I used offset, not scale. |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 08:05 PM |
| I see what you mean. Does it effect it that the Frame doesn't start in the top left corner? It starts in the middle of the screen and is then turned visible. |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 08:07 PM |
| It doesn't matter where it starts, it would set the position of the textlabel to where your mouse is. If you want it to be centered you can do what Joey said? |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 08:09 PM |
script.Parent.OptionsMenu.Position = UDim2.new(0, mouse.X-script.Parent.Size.Offset.X, 0, mouse.Y-script.Parent.Size.Offset.Y)
It says Offset isn't a member of Size. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 08:10 PM |
| .X.Offset (and .Y.Offset) :) |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 08:15 PM |
| Script.Parent's offset is 0, because it's all scale |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Feb 2015 08:17 PM |
If you want the "scale" of the mouse: Mouse.X / GUI.AbsoluteSize.X Mouse.Y / GUI.AbsoluteSize.Y |
|
|
| Report Abuse |
|
|
AntiFiter
|
  |
| Joined: 14 May 2009 |
| Total Posts: 12290 |
|
|
| 18 Feb 2015 08:25 PM |
| It still isn't working right. I'll upload a place tomorrow. |
|
|
| Report Abuse |
|
|