Detect if a player is on mobile or another platform

What would the best way to detect if a player is on mobile or another platform?

All I need it for is to show whether a defeat/victory screen shows a leaderboard or not depending on the players platform. Thanks in advance.


I think the best way is like to have a button on a profile or your friends profile to say what player is on that platform like xbox or mobile or pc.

1 Like

But if it is on script, I think you can get inspiration for games like arsenal, where they show a bunch of where player platform are


Try using this:

local uis = game:GetService("UserInputService")

local isMobile = false
local isComputer = false
local isConsole

if uis.TouchEnabled and not uis.KeyboardEnabled and not uis.MouseEnabled then
    isMobile = true
elseif uis.GamepadEnabled and not uis.KeyboardEnabled and not uis.MouseEnabled then
    isConsole = true
elseif uis.KeyboardEnabled and uis.MouseEnabled and not uis.TouchEnabled then
    isComputer = true

All you have to do is check which variable is true for what you need, and if you want to simplify it more, you could wrap the if statement in a function, and instead of setting a boolean to true, you return a string of what platform they’re on and check what that string is equal to when calling the function

This can also only be done in a LocalScript. If you need to get the value on the server, you can fire a RemoteFunction to the client and return the value that way.

local UIS = game:GetService("UserInputService")

if UIS.TouchEnabled and not UIS.KeyboardEnabled then

Even though there are touch-screen laptops, they still have a keyboard.

Another thing, if they join with their keyboard hidden and a touch-screen laptop, sure, they can be classified as mobile. They can have the controls mobile people have, since they don’t even have a keyboard.


The issue with this approach is that it doesn’t account for varied input across different and potential future platforms. Thinking of devices like the Nintendo switch, Rog Ally or the Steamdeck, where they have no keyboard, but do support touch input and controller input and in the case of the Steamdeck, do have a trackpad which registers as a mouse. Not to mention any other potential different platform inputs in the future.

Ideally the best approach is to simply account for whatever input is present rather than trying to do platform specifics; your game shouldn’t conform to one or the other. The best approach isn’t to find out what platform the user is on but rather find out what they have to work with.

Don’t get caught up in trying to do specifics like this, because it’s a long battle between varied inputs across many different platforms.

Somebody posted @buildthomas’s post on the subject and I advise looking into that.


This breaks on Chromebooks and touch screen devices with PC peripherals. A lot of people use these.

Why are you hiding the leaderboard conditionally, is it because of screen size? Look at workspace.CurrentCamera.ViewportSize instead. You can also check to see when this property changes using GetPropertyChangedSignal (window is resized) so you cover all possible cases too.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.