Hello, I am working on a script that reads players’ screen size, and manually changes the size of a GUI. How it would work is that there are ranges in a script that would determine the scale of a GUI. Whichever range the client’s screen size falls into would change the GUI to that size. However, I do not know an efficient way of doing this. (For example, using elseif statements would make for a very long and messy script.) Does anyone know a more effective way of reading a player’s screen size and assigning a size to a gui?
Code for getting client screen size for anyone who needs it:
local WorkspaceService = game:GetService(“Workspace”)
local CurrentCamera = WorkspaceService.CurrentCamera.ViewportSize
I don’t understand, i would suggest using Scale, for example. 0.5, 0, 0.5, 0 gets half screen of the client. By the way, if you convert the scale to offset you will get better results.
You don’t need any scripts for this. You can use scale and it’ll scale to the user’s screen. If you want to keep the aspect ratio of the gui while it scales you can use UIAspectRatio constraint
The only things you might want to script is making the guis a bit bigger if the player’s on mobile or XBOX, but aside from that no scripting needed.