I'm trying to get a Gui to have a position based off of the size of a players screen (dont say use scale, because the size of the gui is an offset value not scale), but recently I've noticed that the returned value of script.Parent.AbsoluteSize.X
is zero...
Here's my script:
local sizeX = script.Parent.AbsoluteSize.X local fX = script.Parent.Frame.Size.X.Offset -- value is 125 print(sizeX .. ", " .. sizeX - fX .. " sizeX") script.Parent.Backing.Position = UDim2.new(0, (sizeX / 2) - (fX / 2), 0, 0)
Output: 0, -125 sizeX
What am I supposed to do now?
The issue was that the script was running before the ScreenGui initialized, adding a simple wait()
fixed the issue. thanks @cntkillme.