UI fitting problem

i attempted to make gui fit in the mobile with plugin, but this happen

i wanted to make gui sized correctly. and fitted perfectly in any smaller device.

Video:

So yeah. i wanted to make gui fit smaller screen. not size correctly

3 Likes

Based on video it seems like you’re using UIGridLayout which has it own CellSize property or you’re using AutomaticSize which resizes your frame, try to look into those. :thinking:

Ui contain Nothing. just 2 instances inside
image

1 Like

Use a script to check if UserInputService.TouchEnabled is true, and if so, change the size of the ui.

local button = nil -- Put 106 UI Button Here
local mobile = game:GetService("UserInputService").TouchEnabled

if mobile then
    {Insert desired Size/Scale here}
end

technically Solution but it does not work for any resolution

Looks like your CanvasSize is using offset. If not, can you please send an rbxm file of your instance to check all your properties? (Right click on your instance and click save to file)

And yes, you should use Scale for that button named “106”

As Recodetfort said, use scale to properly size the button instead of offset, you can find the Scale property inside both the X and Y size values of your Button.

1 Like

106’s scrolls.rbxm (6.7 KB)

image

You are using Offset for the size, which means that the X size is always the same. (offset meauseres in pixels btw)
Based on your post, you want the size to fill the entire space, so you need to use Scale. Scale is kind of like a percentage of the available area. In our case, let’s set it to 1, which means that the X size will be the same as the Canvas size in the ScrollingFrame.

Unfortunately, nothing has changed. That’s because Position uses Scale, and it’s not shifting the frame the way you want it to. For position, I recommend using Offset.

Before:
image

After:
image

And again nothing is changed.
Thats because your Frame moves to side by that Offset in Position but size of it takes all given place. To fix that, you should account that offset in Size.

Thats how your size looks like:
{1, 0},{0, 53}
And we need to account that offset in Position: {0, 10},{0.026, 0}

So we just substract from our size these 10 pixels from two sides. 10*2=20.
So this is our new size:
{1, -20},{0, 53}
And yes, you can use offset and scale at the same time.


Explanation of that UDim2 {1, -20},{0, 53}:
X will take all given space and then substract these 20 pixels.

So now your frame can be scaled exactly the same on all screens!

image

image

And note that i substracted addictional 12 pixels to account that scrolling line. (10*2+12=32)
image

And here is the position of your button. I recommend replacing Scale in Y with Offset too.
image

Here’s the fixed file:
fixedbutton.rbxm (6.7 KB)

Read this article to learn more:

1 Like

i was about to work on someone’s game but Thank you

1 Like

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