Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
|
| 03 Aug 2016 08:00 PM |
I forget what it's called, but how would I make a GUI TextLabel with the Position of
{0, 300},{0, 20}
and the Size of {0, 1280},{0, 194} instantly resize to the size of the screen?
I know it's possible and have seen it done in other games. If the screen size gets smaller, the GUI resizes so that all of the GUI is seen on the screen, and so that none of the GUI is left out of the screen.
Help? Anyone?
|
|
|
| Report Abuse |
|
|
AxonMega
|
  |
| Joined: 29 Aug 2014 |
| Total Posts: 2403 |
|
|
| 03 Aug 2016 08:02 PM |
| It's called a UDim2. To do this, determine the size of the GuiObject with the percentage part of the UDim2 instead of the offset. |
|
|
| Report Abuse |
|
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
|
| 03 Aug 2016 08:03 PM |
I would need more of a specific explanation...
|
|
|
| Report Abuse |
|
|
j1sh
|
  |
| Joined: 31 Jul 2016 |
| Total Posts: 289 |
|
|
| 03 Aug 2016 08:03 PM |
| Use scale, example: Size of screen is UDim2.new(1, 0, 1, 0) |
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 03 Aug 2016 08:04 PM |
I think this would do it?
gui.Position = UDim2.new(0,0,0,0) gui.Size = UDim2.new(1,0,1,0) |
|
|
| Report Abuse |
|
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
|
| 03 Aug 2016 08:05 PM |
If I was to add that as a script to the GUI, it would scale to the screen's size?
|
|
|
| Report Abuse |
|
|
j1sh
|
  |
| Joined: 31 Jul 2016 |
| Total Posts: 289 |
|
|
| 03 Aug 2016 08:06 PM |
Don't even need it to be a script. It's simply a property of almost all GuiObjects.
http://wiki.roblox.com/index.php?title=UDim2 |
|
|
| Report Abuse |
|
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
|
| 03 Aug 2016 08:13 PM |
Well, when I put it in a script inside of the GUI, all it did was make it go fullscreen...
|
|
|
| Report Abuse |
|
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
| |
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 03 Aug 2016 08:40 PM |
gui.Position = UDim2.new(0,300,0,20) gui.Size = UDim2.new(0,1280,0,194) put in script |
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 03 Aug 2016 08:41 PM |
oh if u constantly use that you have to use getscreensize and a bunch of math
how much are ya payin |
|
|
| Report Abuse |
|
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
|
| 03 Aug 2016 08:51 PM |
I made that the GUI's size, but when I tested it in play solo mode, and lowered the size of Studio's window, it just overlapped with the GUI.
It didn't resize at all.
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 03 Aug 2016 08:52 PM |
im confused if you want the gui to scale with size of window u need to use scale which is the first (SCALE, OFFSET, SCALE, OFFSET)
|
|
|
| Report Abuse |
|
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
|
| 03 Aug 2016 08:54 PM |
What he gave me was something like (1,0,1,0) that made the GUI fill the entire screen, so I did not know if it scaled with the screen or not.
Are you saying I should make it (0.1,0,0.1,0)?
|
|
|
| Report Abuse |
|
|
Xonious
|
  |
| Joined: 01 Jan 2009 |
| Total Posts: 1820 |
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 03 Aug 2016 09:15 PM |
(0.1,0,0.1,0) will make it 1 tenth of the screen on both axis
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 03 Aug 2016 09:16 PM |
to position it say in the center with a size of (0.4,0,0.4,0) position would be (0.3,0,0.3,0)
aka half - size/2
so .5 - .4/2
so .5 - .2
so .3 |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 09:26 PM |
| If you want any gui element to resize to the screen, all you have to do is set the UDim2 Size to (1,0,1,0) (the Scale element being 1 makes the gui element the exact size of the screen on both axes). Then you have to set the position to (0,0,0,0), which is to say, the upper-left corner. |
|
|
| Report Abuse |
|
|
bloberous
|
  |
| Joined: 07 Jun 2009 |
| Total Posts: 299 |
|
|
| 04 Aug 2016 04:45 AM |
As one of the guys said above:
UDim2 - (X SCALE, X OFFSET, Y SCALE, Y OFFSET)
Scale is referring to the fraction of the screen. e.g. Putting "X SCALE" as 0.5 will make its size 50% of the x-axis of the window, no matter what the size is.
If your window's x-axis is 500 pixels, it would be resized to (500 pixels * 0.5 scale) which is 250 pixels.
The same goes with the "Y SCALE".
Therefore, if you size the GUI as (1, 0, 1, 0), you are telling it to resize to 100% of the window in both the x-axis and the y-axis, resulting in it taking up 100% of the window size. |
|
|
| Report Abuse |
|
|