I tried setting up a test place in Studio to test for bugs, and one thing I noticed is that this will not work with frames which use “Offset” as a frame with the default size ({0, 100},{0, 100}) will be set to 0,0,0,0. I decided to modify your script slightly to account for Offset:
info.OpenSize = UDim2.new(frameToOpen.Size.X.Scale, frameToOpen.Size.X.Offset, frameToOpen.Size.Y.Scale, frameToOpen.Size.Y.Offset)
When I tested with that, the Output window correctly printed the following:
13:00:28.122 {0, 100}, {0, 100} - Client - ModuleScript:25
13:00:28.122 {0, 0}, {0, 0} - Client - ModuleScript:27
It looks like it should be working. It animated rather quickly, but it looked like it worked as you intended. However, the frame I tested with was already open and visible and on the screen before I ran the “Open” function of the module. “info.OpenSize” is checked and printed immediately before your script sets the size to 0,0,0,0 and then opens it back up with a tween animation.
I don’t know if this is something that was done intentionally for testing purposes or if it could be the source of some problems, so I just wanted to point that out just in case. I’m assuming this is just for testing purposes because, as I mentioned in my previous reply, your script overwrites “OpenSize” every time you run the Open function. This means that after you close it once, all future attempts to check the size will print 0,0,0,0.
Another solution could be this: As soon as you finish closing it and your size is 0,0,0,0, set “Visible” to false and set the size back to OpenSize. This means that your script will change the size back to what it was before you closed it, so you don’t lose the original size by overwriting it to 0.
If you’re still having any problems, please let me know & perhaps reiterate what you’re trying to achieve (what would the script do if it’s working as intended?) and what obstacles you’re facing (what isn’t working right?) and I’ll be sure to respond as soon as I’m available.
I also noticed that your script required that the button contains a BoolValue object to serve as the ClickCooldown. You could use a similar workaround by giving your frame two (or four if you wanna use offset) NumberValue objects, one which contains the original X value and another which contains the original Y value. These values will be read by the script and never overwritten. Then, if your frame is “closed” (size = to 0,0,0,0), you can tween back to the size stored in the NumberValues.
This certainly isn’t how I would do it, but I think you’d be able to implement it quickly and easily if all other options failed.