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.