Reproduction Steps
Put this in a LocalScript and run the game in a mobile:
game:GetService("StarterGui").ScreenOrientation = Enum.ScreenOrientation.LandscapeLeft
Expected Behavior
The game orientation should be locked in Landscape mode.
Actual Behavior
The orientation is not locked, ie, when rotating the mobile device, it’s entering in Portrait mode also.
Issue Area: Engine
Issue Type: Display
Impact: High
Frequency: Constantly
2 Likes
Can reproduce on a Samsung Galaxy S20FE running the latest version of roblox. Didn’t try putting it in a renderstepped function though.
1 Like
Abcreator
(Abcreator)
August 23, 2021, 5:05pm
4
This is intended behaviour as setting the orientation of StarterGui only affects new players (as stated in the documentation), you should instead run this code:
game.Players.LocalPlayer.PlayerGui.ScreenOrientation = Enum.ScreenOrientation.LandscapeLeft
When a Player joins the game, if they are using a mobile device, this property will determine the device’s starting orientation. - https://developer.roblox.com/en-us/api-reference/property/StarterGui/ScreenOrientation
@rogeriodec_games
No, it’s not:
Also…
If you know how to prevent the game from switching to Portrait, please show us.
Abcreator
(Abcreator)
August 23, 2021, 5:35pm
6
rogeriodec_games:
No, it’s not:
Changing this property will not change the ScreenOrientation for Players already in the game. To change the orientation for an existing player use their PlayerGui.ScreenOrientation property. (https://developer.roblox.com/en-us/api-reference/property/StarterGui/ScreenOrientation )
Also sorry, the code is actually:
game.Players.LocalPlayer.PlayerGui.ScreenOrientation = Enum.ScreenOrientation.LandscapeLeft
4 Likes
system
(system)
Closed
October 25, 2022, 10:19pm
7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.