I need to know if players are on a phone since Roblox only shows 3 tools in your backpack when on a small screen. This way I can let the players know that any other items are in their backpack.
I don’t want to use TouchEnabled since that could alert players on tablets, who (I believe?) can see all 10 items.
There’s the check you want. Just show the “small mobile layout” when the last input mode was touch and the screen is too small to show all items. Use the studio emulator to find a good threshold. Don’t try to write a check “if phone then” based on input capabilities, because this doesn’t scale to all possible form factors. Stick as close to the requirements as possible, don’t abstract it into a device check.
There are multiple ways to get viewport size, I personally prefer workspace.CurrentCamera.ViewportSize because it’s short and doesn’t require additional objects (i.e. gui objects to check absolutesize).
Also recommend using Mouse.Move and if the viewport changed, check it on mouse move and you will be able to adapt GUIs, etc to the new screen size, if the player is playing on half a screen for whatever reason. Unless there’s a better way than Mouse.Move
I have been abusing UI constraints when it comes to different screen sizes. I really like being able to make it once and have it scale with everything.