Have GUI be sized larger on mobile than pc

I am working on UI for a game, and when I made the buttons, the size of the buttons was fine on pc, but on mobile they seemed to be a bit small and hard to press.

I could make the GUI bigger and that would fix it for mobile, but then the buttons will look too big on pc…

Examples:

On mobile its perfect for the fingers to press
image

On pc it fills the screen too much and the buttons way bigger than the cursor.

So, how could I fix this?

2 Likes

Ttry using a UIAspectRatioConstraint instead and insert it into your TextLabel or something, and adjust the properties to whatever you desire,

I get what you are saying, but what i mean is i want to have the gui area be large and fill up most of the screen, but on pc have it be a bit smaller to fit the size of your cursor.

What if you use a ScreenGui’s AbsoluteSize, determine if it is smaller or larger then a set variable, then make the size accordingly? It’s probably not the best way to do it though.

You have alot of plugins made just to rescale the size of an Gui for different devices, just search for Gui Rescaller in Toolbox and it should appear there.

1 Like

I know what you mean, but that is not what i want.

You can tell if the player is on mobile using UserInputService.TouchEnabled and adjust the GUI size accordingly.

local UIS = game:GetService("UserInputService")
local IsMobile = UIS.TouchEnabled

if not IsMobile then
	script.Parent.Size = UDim2.new(sample)
end

Put this code into a LocalScript, and put that LocalScript into the button you want to be affected. Then, replace ‘sample’ in the code with the size the button should be downscaled to on PC e.g. UDim2.new(0.5, 0, 0.5, 0).

2 Likes