How to detect if the user is on phone or tablet

Hello, i would like to know if it is possible to detect if the user is on tablet or phone.

Even tough this topic has been discused a lot of time, i did not find anything concret so i made this post.



There has been a lot of topics about this, you may check them out. One of them have a solution, here. How do I detect if a user is on mobile?

1 Like

Just below they stat that there are maybe window devices which a 100% touch screen and i’ve read in another post that android supports keyboards.

1 Like

It is true that Android devices supports keyboards but hope the post above helps a lot.

1 Like

Using it only resolve a part of the question because i would still not know if it is a tablet or phone.

1 Like

There are already many posts/threads about this topic, please search before making a new post.

As i stated in my post, i’ve done research about it but still haven got any solide conclusion on distinguising the two.

1 Like
local ismobile = game:GetService('UserInputService').TouchEnabled
local isdesktop = game:GetService('UserInputService').KeyboardEnabled

if ismobile == true then
 -- Put your own code here for Mobile
elseif isdesktop == true then
 -- Put your own code here for desktop
1 Like

In my case it is not crucial of having it perfect so i will use something in that direction. I was looking for maybe something more precise but it will go.

1 Like