How to check if a player is on Tablet or Phone

So I have GUI for mobile that I want to keep consistently to the left of the jump button by 10 or so pixels but couldn’t find anything that could tell whether or not the mobile device is a Phone or Tablet on the DevHub. Any idea?

1 Like

AFAIK, UserInputService usually consists of properties like TouchEnabled. Try checking that, but the complication is the phone or tablet. Thus, screen size should be checked.

Question was earlier asked:

You can eventually use the first parameters of Udim2.new(), that are two numbers that Size/Locate the gui based on player’s screen, Udim2.new(1,0,1,0) this for example will give you a gui that fills the entire screen.

So I tested it out and found that the jump button in particular only changes size based off of mobile and tablet and used that to do what I needed instead. Also, figuring out if the player had a touch screen wasn’t the problem.

local JumpButton = PlayerGui:WaitForChild("TouchGui").TouchControlFrame.JumpButton

if JumpButton.Size == UDim2.new(0,120,0,120) then
print("This user is using a tablet")
else
print("This user is using a phone")
end
3 Likes

Please search before posting. There are already many threads about attempting to detect what device a user is using. In that regard though: technically you can’t know what device the user is using, you have to make assumptions based on what type of input they’re passing. GetLastInputType can help you see what the type of input passed was, which you can map out to different devices.

If that doesn’t answer your question, please make sure the title of your thread better reflects the content of your problem. If you need to position a Gui element with another as a dependency, you should be looking for that specific Gui.