Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My GUIs look kinda messed up on other devices. How to fix?

When I test my game on mobile, the Text in the GUI Buttons stay the same size but the Button itself gets smaller. The buttons also seem to lose parts of their outline. On larger devices, the entire GUI goes slightly off screen. I have tried GUI Scaling and changing offset to 0 and i have tried Aspect Ratio constraints (I am using both of these together at the moment.) Any help would be greatly appreciated, below are some images of the problem.

iPhone 4S

Xbox One

Thanks! -Noob0844

3 comments

0

Sorry for the unoffical answer i'm fairly new to scripting. Have you tried the User Input Service because I belive you could see if the gamepad input was detected. (Xbox Controller) or Mobile So then you could make it so the gui would be scaled to fit an xbox screen if Gamepad was detected or a mobile screen. Sorry I don't have any code rn and I only started coding last summer, but I believe this

0

that'll work

0

Oh hey good idea! Will try!

2 answers

✓ Accepted answer

Ok so you can use UserInputService to do this:

local UserInputService = game:GetService("UserInputService")

if UserInputService.TouchEnabled == true then
	--write your positioning code here
	--i.e. button.Position = UDim2.new(0,0,0,0)
elseif UserInputService.GamepadEnabled == true then
	--XBox
elseif UserInputService.KeyboardEnabled == true then
	--pc,Mac
elseif UserInputService.VREnabled == true then
	--VR
end

Just an example. Insert this as a LocalScript in the GUI or if you already have one in the GUI, put it into that.

Happy to help, b_mni.

Try using anchor point and try setting the position on the X and Y axis, not the offset. This means that in any device, the positions will work the same as it will work for you.

This discussion is preserved as it was. New answers, comments, and votes are closed.