Gui looks different in game

So this is what my gui looks like in studio, what i want it to look like:

And if I load the game into roblox for some reason it looks like this?:

Heres the gui addons:
image

if anybody knows how to fix this please lmk!

1 Like

This most likely is because of how you used scale or offset in the scale and/or positions with UDim2. Try resizing the studio window to see if the same thing happens.

Yeah the texts and icon still get resized for some reason

image
this is what it looks like

As @GuySalami said, GUIs use UDim2, basically, they have an XOffset and YOffset value, which act just as you would expect, a number representing the size of the gui in pixels, but they also have an XScale and YScale value, what’s happening here is that you’re changing the size of the screen, meaning there are less pixels, but the gui object still takes up the same number of pixels, so now it just occupies more of the screens pixels, the solution is to use the scale values instead of the offset, which essentially just tell it to occupy a certain percentage of the total number of pixels of the parent gui object instead of a simple pixel count.

To get the right scale value from your current offset value you have to divide the offset value of the gui object as it currently is by the size of the parent frame, so if the gui object is 20x20 pixels, and the parent frame is 100x100 pixels, the gui object should have 0.2x0.2 scale and 0x0 offset, which would make it be 20x20 pixels in the parent frame, except if the parent frame changed size to be 120x120 pixels the gui object would also change size to be 24x24 pixels.

I don’t understand this a lot, what do I need to change for it to size with the screen pixels?

The size looks like this, 0,100,0,100, this means 0% of the parent guis size+ 100 pixels X, and 0% of the parent guis size + 100 pixels Y
image
In my case the parent gui object is actually the ScreenGui, which is currently 1309 by 607 pixels.
image
What I’m going to do is find out what percentage of 1309 100 is, so 100/1309, which I know equals 0.07639 thanks to the power of calculators.
image
So now my frames size is 0.07639% of the parent size + 0 pixel offset X, and 0% of the parent size + 100 pixels offset, but I know 0.07639% of the parent size is 100 pixels at my current screen scale, so it should be 100 by 100 pixels right now.
image
Yet if I make my screen smaller, the X size gets squished proportional to the screen size.
image
So on the X axis this gui takes up the exact same percentage of the screen that it did before, which means occupying 51 pixels since the screen is now almost half as small as it was before, but on the Y axis where I left it using 0% scale and 100 pixels offset, it still takes up exactly 100 pixels, even though the screen is half the size, so it occupies more of the screen.

It is crucial to note that it is not proportional to the size of the screen, but the size of the parent gui object, which could be the ScreenGui that contains your gui (ScreenGuis always take up 100% of the screen), or it could be any other gui object, here this gray square is inside of this white square, so it scales with a certain percentage of the white squares size.
image
image
Ofcourse since the white square in this case also uses scale instead of offset in its size, the white square would still shrink with the screen, and then the gray square would shrink with the white square, so now this system always occupies exactly the same amount of screen real estate, on the x axis atleast.

Unrelated side note that doesn’t really matter: Where I’ve been saying percentage those weren’t really percentages since percentages go from 0 to 100, and the scale value of UDim2 goes from 0 to 1, but I figured it got the point across.

2 Likes

Here are some resources in addition to the great explanation by @Absolute_Decimation,

1 Like

image
is it your Guilnset? just guessing

AH i get it now! I’ve fixed the issue also, thanks so much man!! :))

1 Like

thanks for all the help!!! all fixed now :))

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.