Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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

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 EyeDontLie 2 — 3y
0
that'll work User#29913 36 — 3y
0
Oh hey good idea! Will try! noob0844 -3 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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.

Ad
Log in to vote
0
Answered by 3 years ago

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.

Answer this question