Is there a way to detect if a player is on a tablet or phone?

So I’m making a survival game, and I need to find out a most reliable way to get what device a player is on. I use MouseEnabled, but I need to know if the players are on a phone or tablet to size a frame’s template I have, or is there a way to make text without textscaled size to 14 if a player’s on a phone, otherwise 20?

Your best bet is probably going to be something along the lines of:

Why go through the trouble of checking whether or not the player’s on a phone? Why not just check their screen size directly and resize your text based on that?

Wouldn’t I have to directly add the frame sizes for each device then?

Nope. If you think the screen size is too small, then set the text scale to 14. Otherwise, set the text size to 20. How to decide whether the screen size is too small is up to you.

This is good advice because even desktop players can have small resolutions. If you set their text size to something large just because they’re on desktop, then you’re going to inconvenience them.

1 Like

Hm, is the VGA a most common desktop resolution? I dunno.

It isn’t, but players can be playing in windowed. There are also large tablets like the 12.9 inch ipad pro which have screens larger than most laptops/netbooks. Your text would appear very tiny on those devices if you resized your text solely by device type.

3 Likes

I’ll just used TextScaled and hope it works. Ty though

2 Likes

Using relative scale for sizing UI components is usually preferable. You ultimately don’t know how large the text is going to be on the client, because even the pixel dimensions (e.g. Camera.ViewportSize or AbsoluteSize of full-screen ScreenGui) don’t tell you about the resolution of the screen or physical size, so you don’t really know how large (in inches or cm) 14pt text really is. I size the fields as big as I can, and use TextScaled, and I use the emulator in Studio to spot check new layouts on a few different devices.

You may benefit from considering that “VGA” is not a resolution. Also, regardless of the video output format on a given device, pixel resolution varies widely from one machine to another, and can change whenever the output display changes.

1 Like