Allow us to use :GetPlatform()

The developers already discussed about this so I would like to move that topic here. I think they are speaking facts and roblox should let us use UserInputService:GetPlatform() to make it easier to identify the OS the player is using without needing to do hacks.

https://devforum.roblox.com/t/why-is-userinputservicegetplatform-locked-any-plans-to-lower-the-security-context/2786230

9 Likes

You cover what you want, but why do you want it? A lot of people wanted GetPlatform for setting up user interfaces, but it is a horrible idea because any platform could have (or more importantly - switch to) any input device now or in the future.

2 Likes

It would help alot to identify what type of device the player is using for example

this line of code would most likely identify Windows 10 S users with touchable screen

that would allow me to enable touchable buttons and clickable buttons by a mouse (two in one at the same time)

if UserInputService.TouchEnabled and UserInputService:GetPlatform()==Enum.Platform.UWP then

end
1 Like

More use cases and reasons, less solutions are the way to go. Could you provide why?

Best practice is to monitor the currently used input type and adjust your UI based that. See this: Cross-Platform Design | Documentation - Roblox Creator Hub

2 Likes

:GetPlatform() would also help analyse who dominates my game the most in details I know I know you can already check that in analytics tab in your game but hear me out :GetPlatform allows me to do that in detail so i can check if its windows users that dominate my game or is it linux users that dominate my game on PC platform (or is it android users that dominate my game or is it ios users that dominate my game on mobile platform)

1 Like

Why do you want that? Your user interface should be able to accept any input at any time. Got a Steam Deck running Windows and using the UWP app? You’ve got a mouse, touchscreen, and gamepad at the same time.

Are you able to back up why the operating system is more important for gameplay-related analytics than input methods? 1 Windows user dominating another by a lot may not tell you much until you realize one is using a gamepad while the other is using a mouse. That seems much more useful to act on than “Windows users are better than the macOS users”.

3 Likes

You can make seperate versions of your game with this while sharing the same codebase, so if you want to seperate console players from PC and also add a few differences

But i think you can already check for when a game is on console already and getting other platforms like mobile is unnecessary except for a few niche use cases but could still be useful for maybe tweaking your game with platform specific features and your game is singleplayer with enemy npcs you could check if the game is currently played on PC, enable ability to increase/decrease npc limits but if your on mobile or something then lock that to hard-coded limit idk

Also i feel like opening up GetPlatform() would allow for more malicious actors in Freemodels but idk

1 Like

I don’t think you would want to rely on platforms as opposed to the input methods. There is no security benefit because you would still need to trust the client on their platform or input methods. UserInputService:IsTenFootInterface() should tell you who is a console player without needing to maintain your own list, and Roblox would maintain which devices this is for internally. Without that, any time a new console gets added (like PlayStation last year), that would be on you to add that device entry.

People have been wanting GetPlatform() for years. I remember them covering that at RDC 2016. I’m not against it being unlocked for us, but I am concerned with the use cases that really should rely on inputs instead of the platform. If you lock your keyboard/mouse inputs because you detect a touch screen and assume mobile (which I have played - or more realistically, quit because I couldn’t play as I wanted), you are doing it wrong.

3 Likes

No, but I think you could also use it for locking features or optimization.

For example disable CastShadow if android OS was detected so it doesnt lag enable CastShadow for PC users (windows, linux)

You could also use it for making a feature and you want to push it out only for Windows users well here you go :GetPlatform is your best friend and you can push out that beta feature only for Windows users

True but that doesnt mean that every single player is using cheats/exploits of course there will be some legitmate players that wont be able to use the beta feature you released only for Windows users (until they get a device with Windows installed on it or they use virtual machine)

I can already imagine something like these lines of code i added into spoiler in a random free model

(cringe alert :skull:)

if UserInputService:GetPlatform()==Enum.Platform.Windows then
     LocalPlayer:Kick("haha linux better switch to linux now")
end

Then you want easier access to performance specs, not a way to get platform. What stops an Android phone from being one of those crazy gaming phones, and what stops a PC from being some ancient junk?

Why? The whole point of Roblox is that you don’t have to worry about these kinds of things. A mobile user and a PC user can have access to the exact same experience.

3 Likes

Also for seperating PC from console can also be just done by doing what PF does, make 1 place for PC and other for consoles as long you have a way to maintain both codebases, so a shared codebase is a must here and this is mainly useful if you wan to seperate aim-assisted console players from PC keyboard/mouse players.
While GetPlatform() would be nice i think you’re right that it’s better to make the inputs work for all devices rather than rely on one.
Still, there are niche use cases for GetPlatform() so it’s still would be nice if they unlocked it, it’s just not a top priority must need now thing

1 Like

Not a single use-case for this function on our side as developers is good practice.

In all cases, you should have your UI responsively react to the user’s chosen method of input, be it keyboard, mouse, touch screen, gamepad, or VR controls; this is maximally forwards compatible as new devices, peripherals, etc. become widely adopted. You should never segment using separate places, this divides your playerbase too much. You can use separate UI setups for different input modes, but bear in mind this is jarring for the user if they switch input methods mid-gameplay. This should all be hotswappable on the fly during gameplay for the best user experience.

4 Likes

In short, stop using UserInputService all the time and use ContextActionService more often

https://devforum.roblox.com/t/why-is-userinputservicegetplatform-locked-any-plans-to-lower-the-security-context/2786230/32

Linux isn’t tracked by any analytics. Roblox is not officially supported on Linux (afaik), and you have to run the Windows version through a compatibility layer like Wine, Vinegar, or Grapejuice. I’m not sure how :GetPlatform() would help you in that case.
Regarding mobile devices, you can use analytics and breakdown by platform. Also, what is the specific reason you need to know the exact device type and vendor of your players devices?

One possible use case would be to check whether users are using mostly high end devices or low end which is not possible I’m afraid. Also I actually found an alternative to GetPlatform so that’s nice

1 Like

Feels like the infamous XY problem to me. Graphical settings shouldn’t be based on OS, they require APIs to get performance capabilities.

With :GetPlatform() you can’t separate:

  • a low-end Chinese android phone with a high-end Galaxy S series phone
  • an outdated iPad with the latest iphone
  • a 2012 office laptop with a gaming PC

It simply says nothing about performance.

7 Likes

Oh then i misunderstood what GetPlatform is