How do I set a frame to be a certain size on gui reset?

  1. What do you want to achieve? I want a frame to have a size of the current topbar size (which, as far as I know, must be set from a script, and cannot be defined in the “Size” property)

  2. What is the issue? When the frame is resetting, it’s using a placeholder size (which could be set to the normal topbar size, and technically solve the issue) instead of using the size I want to be set when the script changing it to the correct size is run.

  3. What solutions have you tried so far? I’ve searched for a solution for this issue, and I’ve found solutions like this, but they didn’t seem to actually come to a solution.

Here’s the code:

local topbarY, topbarX = guiService:GetGuiInset()
musicGui.MainFrame.Size =,0,0,topbarY.Y)

You can try to set the SizeConstraint property of the frame.
Reference to GUIObject.SizeConstraint

You can set it to Enum.SizeConstraint.RelativeXY.

The SizeConstraint property of the mainFrame is already set to “RelativeXY”. I believe it’s the default, because I didn’t change it.