Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

2 comments

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.

0

What? Will it not work efficiently if i don't use game:GetService('Players').LocalPlayer.PlayerGui?

1 answer

✓ Accepted answer

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.

1 comment

0

TQ

This discussion is preserved as it was. New answers, comments, and votes are closed.