Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you change the size of a ScreenGui Object using a script?

Asked by 4 years ago
Edited 4 years ago

I want to try to change the size/position of a ScreenGui Object using a script. Though I have found that you can't, because:

local startergui = game:GetService("StarterGui")

a = Instance.new("TextLabel", startergui)
a.size = ____ --The problem is here--

I thought I could use Vector2 to change the size, but there is the "Offset" property too. Please help. Thanks in advance.

0
Only way to change the size of a ScreenGui is by changing your screen size. Hence "ScreenGui," and not "Gui." Because it fits the entire screen. Also, are you trying to execute this using the command bar? If not, then use game:GetService('Players').LocalPlayer.PlayerGui. Fifkee 2017 — 4y
0
What? Will it not work efficiently if i don't use game:GetService('Players').LocalPlayer.PlayerGui? SuperPoopyPoopPoop 21 — 4y

1 answer

Log in to vote
0
Answered by
JakyeRU 637 Moderation Voter
4 years ago

Hello. You have to use UDim2 Here is an example:

local StarterGui = game:GetService("StarterGui")
local ScreenGui = Instance.new("ScreenGui", StarterGui)
local TextLabel = Instance.new("TextLabel", ScreenGui)

TextLabel.Size = UDim2.new(1,0,1,0)

That code will create a TextLabel on fullscreen.

0
TQ SuperPoopyPoopPoop 21 — 4y
Ad

Answer this question