Player:IsMobileClient()

There is currently no easy way to detect if a client is mobile. Currently, we need to compare the screen size and touch-screen and hope it works.

[code]local isMobile = game:GetService(“UserInputService”).TouchEnabled

print(isMobile and “Client is on a mobile device.” or "Client is not on a mobile device.)[/code]

[quote] [code]local isMobile = game:GetService(“UserInputService”).TouchEnabled

print(isMobile and “Client is on a mobile device.” or "Client is not on a mobile device.)[/code] [/quote]

one week later: Ohey devs, touch monitors can now have touch support

“Description: Becomes true if the device being used by a user has a touch-screen available.”
My Lenovo Yoga 2, and many other all-in-ones have touch screens, so the property would return true if I am correct.
Edit: @Weeve: So, am I wrong on this?

[quote] [code]local isMobile = game:GetService(“UserInputService”).TouchEnabled

print(isMobile and “Client is on a mobile device.” or "Client is not on a mobile device.)[/code] [/quote]

one week later: Ohey devs, touch monitors can now have touch support[/quote]

Interesting. I was thinking the exact same thing. :durrr:

[quote] “Description: Becomes true if the device being used by a user has a touch-screen available.”
My Lenovo Yoga 2, and many other all-in-ones have touch screens, so the property would return true if I am correct.
Edit: @Weeve: So, am I wrong on this? [/quote]

Currently it’s false for touch screen monitors, but they could easily change it to true, as it being false is ‘unintended’ behavior, not sure what all in ones do, as it was tested on a touch screen enabled laptop

Alternative:

game:GetService("UserInputService").MouseEnabled

That should be true if the user has a mouse, false otherwise.

[quote] Alternative:

game:GetService("UserInputService").MouseEnabled

That should be true if the user has a mouse, false otherwise. [/quote]

Ohey devs, if you plug a mouse into your tablet, MouseEnabled will be true now! Isn’t this such a great update?

It is locked because the admins don’t want us to be able to differ between Windows, Mac, iOS, Android, and Kindle Fire.

[quote] Alternative:

game:GetService("UserInputService").MouseEnabled

That should be true if the user has a mouse, false otherwise. [/quote]

Ohey devs, if you plug a mouse into your tablet, MouseEnabled will be true now! Isn’t this such a great update?[/quote]

The reason those changes would be an issue is because you guys are checking what platform the user is for the wrong reason. If you want to enabled touch controls, use the TouchEnabled. If you want GUI different for lower resolution, just check the screen absolute size. I’m not sure why you would actually need to know if a user was using a laptop versus phone without the other information.

[quote] [quote=“Programmix” post=189570]Alternative:

game:GetService("UserInputService").MouseEnabled

That should be true if the user has a mouse, false otherwise. [/quote]

Ohey devs, if you plug a mouse into your tablet, MouseEnabled will be true now! Isn’t this such a great update?[/quote]

The reason those changes would be an issue is because you guys are checking what platform the user is for the wrong reason. If you want to enabled touch controls, use the TouchEnabled. If you want GUI different for lower resolution, just check the screen absolute size. I’m not sure why you would actually need to know if a user was using a laptop versus phone without the other information.[/quote]

And if you want a cheaper Dev Product for mobile users?

I think what we should have is UserInputService.Platform
It doesn’t have to be anything specific, like “OS X” or “Windows 10”, just an enum of some simple things, like:

[ul]
[li]Computer[/li]
[li]Mobile[/li]
[li]Console[/li]
[/ul]

Better example: What if you want a button and script that only appear on mobile for mobile ads.

Better example: What if you want a button and script that only appear on mobile for mobile ads.[/quote]

You disagree with my discrimination, I feel offended now. </3

Better example: What if you want a button and script that only appear on mobile for mobile ads.[/quote]

Fair enough. I can see the use of getting the OS flavor or the client.

It is locked because the admins don’t want us to be able to differ between Windows, Mac, iOS, Android, and Kindle Fire.[/quote]

This is so stupid. We’re going to do that no matter what with the tools we have available. The issue here is giving us a legitimate, future-proof way of doing it versus giving us a roundabout way of kind-of doing it that jeopardizes possible future updates (touch monitors on pc are basically out of the question already because every single game would start treating them like mobile).

[quote] I think what we should have is UserInputService.Platform
It doesn’t have to be anything specific, like “OS X” or “Windows 10”, just an enum of some simple things, like:

[ul]
[li]Computer[/li]
[li]Mobile[/li]
[li]Console[/li]
[/ul] [/quote]

“Mobile” is too vague, we need to be able to distinguish between tablet and phone as well.

It is locked because the admins don’t want us to be able to differ between Windows, Mac, iOS, Android, and Kindle Fire.[/quote]

I figured out an interesting way to differ between windows and mac, not sure how it works on ios and android.

[quote] I think what we should have is UserInputService.Platform
It doesn’t have to be anything specific, like “OS X” or “Windows 10”, just an enum of some simple things, like:

[ul]
[li]Computer[/li]
[li]Mobile[/li]
[li]Console[/li]
[/ul] [/quote]

“Mobile” is too vague, we need to be able to distinguish between tablet and phone as well.[/quote]

Why? The only difference is screen size and we can already check that. Processing power varies greatly across supported tablets and phones.

Every time I’ve pitched for GetPlatform() to be unlocked, an admin comes back with weird reasons to not do it. I don’t understand any reason why it can’t be exposed to us. It is really frustrating. Perhaps if they tried to build a cross-platform game themselves on Roblox, they’d see the reason why it would be helpful.

1 Like