On phones and tablets, the device orientation can have a profound impact on gameplay. For example, landscape mode is best operated with two thumbs while portrait mode may lend itself to one-finger gameplay.
By default, Roblox games run in landscape mode, allowing the game to switch between landscape “left” and landscape “right” as the player’s device rotates. However, games can be locked to a particular orientation if desired.
There are five different orientation modes, including two sensor modes and three locked modes.
|Landscape Sensor||The default Roblox setting in which the game will always appear in landscape mode (no portrait mode) and the device will detect its physical orientation to ensure the game view is always oriented upward.|
|Sensor||The device will detect its physical orientation to ensure the game view is always oriented upward, switching between landscape and portrait mode as needed.|
|Landscape Left||On devices with a physical home button, it will be to the left of the display. On devices with a virtual home/nav bar, its touch region will be at the bottom of the display.|
|Landscape Right||On devices with a physical home button, it will be to the right of the display. On devices with a virtual home/nav bar, its touch region will be at the bottom of the display.|
|Portrait||On devices with a physical home button, it will be below the display. On devices with a virtual home/nav bar, its touch region will be at the bottom of the display.|
There are three ways to work with device orientation:
StarterGui/ScreenOrientation sets the default orientation for a place. Acceptable values include:
Because this property affects all new players who join the game, you can simply set its value in StarterGui → ScreenOrientation within Studio.
PlayerGui/ScreenOrientation explicitly changes the game’s orientation for a player. When this property is set to one of the
enum/ScreenOrientation|ScreenOrientation enums in a
LocalScript, the game will immediately orient itself to match the setting. This can be useful when a game needs to provide a particular experience like locking the view to portrait for a minigame.
PlayerGui/CurrentScreenOrientation gets the current device orientation. Possible values include: