Hello, Roblox developer community! Let me keep this simple and clear:
I am making a shop gui for a game and the only things that do not scale to match device screen resolutions are the children of a scrolling frame. Does anyone know how to make it so that the children of a scrolling frame will scale to match the resolution of any device? Please let me know!
Okay, so Offset just scales based on pixels rather than relative to the actual size of the screen.
Scale sizes relative to the Parent size. So, let’s say our screen is 900x500 and we have a ScreenGUI the same size. If I set a Child object size to {0.5, 0}, {0.5,0} then it will be 0.5 * 900 for the X size, so 450 in offset, and 0.5 * 500 for the Y size, 250.
They can be any number, but it sizes as a 100th / percentage of the Parent UI object. So the Scale {0.5, 0}, {0.853, 0} would make the UI object X size 50% of the Parent’s X size, and the Y 85.3% of the Parent’s Y size.
So if you have a ScreenGUI that has 1 for both Scale values, it will be 100% the size of the players’ screen, so it will be the same size as the screen.
Then, if we had a Frame in the ScreenGUI, and it had size value {0.5, 0}, {2, 0} then it would be half (50%) of the ScreenGUI’s width, and twice (200%) the ScreenGUI’s height.
If you set a UI size via Scale before scaling it with dragging, then it will size itself in scale rather than offset.
If you don’t use the drag, then I try different values and estimate with my eyes, e.g. if you look at a frame, you can estimate where the halfway point is, quarter, third, etc. and just go based off of that.
But if you want to be precise, calculations are super simple if you want to do that way instead. E.g. if your ScrollingFrame is 500 in width, and the child frame is 400, then just do 400/500 and there’s your value.
It depends on what the Parent of the frame is. If I have Frame1 parented to Frame2, then to turn it to scale you do Frame2 / Frame1. So, Child size ÷ Parent size to convert to scale. I don’t think you need to change canvas size.