Won't change to portrait orientation for in game phone

This a local script in the starter gui. Its for a in-game phone and basically I want it to put the screen in portrait mode when opening the phone since it can be much bigger and easier to use that way. Iv’e seen other games do this, for example when you walk up to a fishing spot on meepcity, it puts your screen in portrait and I just checked meepcity again to see if it works and it still does

local gui = game.Players.LocalPlayer.PlayerGui

script.Parent.Button.MouseButton1Click:Connect(function()
	
	local BearChat = gui.PopUps.BearChat
	
	BearChat.Visible = true
	gui.Main.Enabled = false
	
	BearChat.Size = UDim2.new(0,0,0,0)
	BearChat.Position = UDim2.new(0.5,0,1,0)
	BearChat:TweenSize(UDim2.new(1, -40, 1, -40), "Out", "Quint", .3, true)
	BearChat:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Quad", .15, true)
	
	local StarterGui = game:GetService("StarterGui")
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
	if game.Players.LocalPlayer.PlayerGui:FindFirstChild("TouchGui") then
		game.Players.LocalPlayer.PlayerGui.TouchGui.TouchControlFrame.Visible = false -- btw, this part works so I know it's finding the touch gui
		game:GetService("StarterGui").ScreenOrientation = Enum.ScreenOrientation.Portrait
	end
end)

You don’t need that . Just use GUI scale

Yes I actually do, i’m not just gonna use some hackey solution

What do you mean?

Its perfectly fine to use a plugin such as AutoScale in order to scale your UI’s.

And it’s not a cheat. It’s inefficient to have scripts managing all of this.

1 Like

What my problem is is that it is not going into portrait mode, so how do I fix that? There are no errors or anything

Can you even set the phone to be portrait mode?

Can you give an example?

1 Like

Heres the phone and as you can see on mobile it is too small to interact with but if it were portrait it would be much better

Ok, i posted a screenshot of the phone, what i want is when i open it on mobile it will make the game portrait while its open so it will cover more of the screen, on computer its fine cuz of the bigger screen, that portion of the script is not working

Okie, i fixed it

local gui = game.Players.LocalPlayer.PlayerGui

script.Parent.Button.MouseButton1Click:Connect(function()
	
	local BearChat = gui.PopUps.BearChat
	
	BearChat.Visible = true
	gui.Main.Enabled = false
	
	BearChat.Size = UDim2.new(0,0,0,0)
	BearChat.Position = UDim2.new(0.5,0,1,0)
	BearChat:TweenSize(UDim2.new(1, -40, 1, -40), "Out", "Quint", .3, true)
	BearChat:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Quad", .15, true)
	
	local StarterGui = game:GetService("StarterGui")
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
	if game.Players.LocalPlayer.PlayerGui:FindFirstChild("TouchGui") then
		game.Players.LocalPlayer.PlayerGui.TouchGui.TouchControlFrame.Visible = false
		local playerGUI = game.Players.LocalPlayer:WaitForChild("PlayerGui")
		playerGUI.ScreenOrientation = Enum.ScreenOrientation.Portrait
	end
end)