How to detect if the player is on xbox one?

How can I detect if the player is playing on Xbox one?

Please provide sample code for me, thanks.

3 Likes

It’s a Boolean.


if game:GetService('GuiService').IsTenFootInterface then
-- Console.jpg
end

5 Likes

Knowing the user’s platform is useful for metrics and user data, but otherwise if you need platform you’re probably doing something wrong. For input you should be checking UserInputService’s GetLastInputType / GamepadEnabled, and for UI you should be making your UI scale across various resolutions instead of preset UI sizes. If you use platform for input or UI your game will behave poorly on pretty much every device except your own.

3 Likes

This is a rare case where knowing the platform is helpful.
When you’re 10 feet from a screen, you generally want larger UI+text and lower FOV to help with eye strain.

1 Like

Agree to most of the post regarding the input parts, but:

Please don’t do that for input, GetLastInputType is superior. You want your games to be fully responsive to changes in user input and not i.e. only bind gamepad stuff when a gamepad is connected.

In my experience GamepadEnabled is only useful if, for whatever reason, you need to give specific feedback messages like “Use your controller for a better gameplay experience”. I wouldn’t use it for anything else.

It may seem a bit overbearing, but a lot of games on Roblox do this wrong (i.e. showing Xbox labels / rumbling the controller when the last input type wasn’t even controller), so I feel the need to point this out.

5 Likes