I want to make a script for auto change ScreenGui's AbsoluteSize.
Just like this:
local Camera = workspace.CurrentCamera local GuiScreen = game.StarterGui.ChooseYourPower local CameraSize = Camera.ViewportSize GuiScreen.AbsoluteSize = CameraSize
But it's says: can't set value
Any ways to make it can set value?
Thanks!
ScreenGui acts as a placeholder for resize-able objects within the PlayerGui.
You cannot resize ScreenGui objects directly, as they do not have a Size property. If you click on your SG and view it from the properties window, you will see that such a property does not exist.
Instead, it is required you fill your SG with other elements that are resize-able. Such elements include the following:
1) Frame
2) ScrollingFrame
3) TextBox
4) TextButton
5) TextLabel
6) ImageButton
7) ImageLabel
Here is an example of a frame being resized and moved within an SG.
local Players = game:GetService("Players") local PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui") local ScreenGui = Instance.new("ScreenGui", PlayerGui) local Frame = Instance.new("Frame", ScreenGui) Frame.AnchorPoint = Vector2.new(0.5, 0.5) Frame.Size = UDim2.new(0, 100, 0, 100) Frame.Position = UDim2.new(0.5, 0, 0.5, 0)
However, if you wish to manipulate all the elements within a ScreenGui at once, this is possible using ROBLOX's fairly new UI constraint objects. If you wish to learn more about these, take a look at this.
Hope this answered your question.