HiI am looking into making a lot of UI for some stuff I am doing and I would like to make the process simple. How would I go about scripting UI? Please recommend some resources that can assist me in this endeavour.

For referencehere is the last thing I’ve scripted with UI and I am not really proud of it…


You can see that I have been using EgoMoose’s gui library and it is just troublesome to work with!

Due to common misconceptions with why this is in Code Review Here are my reasons:

  • It is not Art Design Support since this is a scripting problemnot an art problem. I do not care about how my UI looks and what I can do to make it prettier because that is not the feedback I want.
  • After further considerationI have moved this Post from Scripting Support into Code Reviewsince it is not seeking to solve a scripting problembut rather improve on already existing code.
1 Like

Are you planning to make something specifically similar to thisor are you asking generally?

If you areyour best bet is probably just to use a UIListLayouta templateand a loop. The filter can be applied afterwardsmaking frames that don’t meet the requirement Visible to false.

1 Like

I am showing what I am already capable ofthe image shown is my experience with making ui. The reason I am showing this is that I am not a beginner.
I am asking for a better way of scripting ui.

1 Like

Yeahbut… what does this mean? Can you show code that we can improve or something? We can’t identify a better way if we don’t know how you’re doing it.

(also that would somewhat turn this into a Help and Feedback > Code Review topic)

I am asking for more of a workflow rather than a scripting problem. I often get frustrated with having to manually script the ui over and over.

1 Like

Ui is the one script thing that I really don’t like doing

What I’ve found works best for me is making a Ui library and prefab ui elements (which includes custom scrolling frameviewport buttonbasically more complex ui elements). This is howeverquite an investmentI would recommend perhaps finding another ui library that fits your needs

The other solution I opted for once was scripting all the Ui raw. It actually works okbut the scripts end up massive (though since it’s uiit’s not complex codeso massive scripts is less of an issue)

I just cannot make Ui by hand (from studioand not from scripts)it just doesn’t work for me. Even all the fancy no script features roblox addedthere is always something you need to script (something as simple as making the size of the Ui grow non linearly with the screen size)

Ui libraries make scripting Ui fasterand lead to a consistent Ui in your projectwhich is nice

3 Likes

honestly at first glance i really liked your first UI. i briefly came across Myzta’s video on how to organize your scripts etc the other day. hopefully this is helpful :slight_smile:

8:41 onwards but i timestamped it for u anyways:

I am looking forward into making a custom ui library for my own needs as I believe that Roblox is missing some important ui features (like a color picker). Although I will still usually have to be scripting it raw whichas you saidmakes the script very long and tedious to go over.

I am looking foward into UI libraries yet I have had a bad experience with React lua and EgoMoose’s Ui lib. Some suggestions for a ui library would be good.

ive found success in just making and using the raw instances since a few purpose-built wrappersfor me its easier to control and layout if i do everything myself with that

though your UI? only thing its missing is stying (which could be fixed by adjusting the borders and changing the colors)
the layout is quite nice

What do you mean by ‘manually script’ the UI? Isn’t all scripting done manually anyway?

I don’t know if this will helpbut here’s a screenshot of my organization’s to script UI. Feel free to ask questions.

1 Like

I have no words and I am deeply horrified from this.
For onewhy do you have individual utils under the modules?? I keep all of my utils within Replicated Storage or my libraries. Sure you have a dedicated utilities folder but that just ruins the folder itself if you have modules named “Utils” under some modules…
image
Like this ^

And another thingwhy are there so many modules…??? The main point of having multiple Screen guis is that they each do their own thing and should have a local script under it. I don’t see how this is necessary as it only over complicates things…

erm because he only uses them once and only in that script

That is poor usage of a module script. At that point the utils should be a function within the script.
Modules are meant to reuse code in multiple scriptssimply using them once is just terrible for the sake of it.

You should probably keep modules you’ll only use on the server in ServerScriptService. Have two utility folders.

He probably uses SSA (or a module loader)

1 Like

I’ve looked through this video and from my 5+ years of using Roblox StudioI don’t really agree with this sort of organization (even the ui part). This video is irrelevant to the issue I am having that being scripting UI. I am not looking for another way to organize them since I already have my own way of organizing my code and assets.

The local script wait for the player data to be loadedthen require all modules inside the ScreenGui folder.

All modules under the ScreenGui folder act as independant local scriptthey all run through an individual thread and do not return anything to the local script.

The utils module inside some of them are only used by it’s parent moduleit contain frequent used functions and mostly serve to reduce main module lenght a bitto clean it up and make it more readable.

All modules under the Utilities folder are meant to be used by most ScreenGui modulesthey contain commonly used variables and functions.

There is no point to store modules in replicated storage if they are not used by the server.

I’m not a fan of placing local scripts inside the PlayerGui. Spreading scripts everywhere is annoying. I prefer keeping all of them to the same places (StarterPlayerScriptStarterCharacterScript & ServerScriptService)and I choosen the best organization that work well to script all GUI without using many different local scripts that fill-out the StarterPlayerScript storage.

There is no overcomplicationit is simpler since all the scripts are in the same location. In factit doesn’t change anything or require extra work.

3 Likes

It’s just an organization thingbut it’s preference for everyone.

1 Like

I do not see how this is relevant and am confused on what this is referring to… the main point of utilities is to provide a function that is used in many different scripts and client-sided scripts are no exceptions. However I can see how some utilities that are meant for server usage only should be kept on the server.

I feel as though we are deviating off the issue that I am having. Which is what I can do to script my UIs in a better waynot how organize my UI code should be.

The main point of this post was to see what other devs do to script their GUIslike there’s React lua but I’ve never had ay experienced with it other than knowing that its a direct port of React…

And I don’t really know what Fusion is other than it being similar React Lua…

Really I would like to know how devs use these tools into their workflow and how it benefits them as a whole as well as what other libraries they use.

1 Like

Thinking outside the box is valuable for many things. Modules can be used in various waysnot just as code storage or OOP. I don’t see how it’s a bad thing to use modules the same way as normal scriptssince they are still scripts and run as an extension of the script that requires them.

2 Likes

well you’re asking 2 different questions now and crygen gave solid advice already but if u want to improve your code u should be showing it so that we can help u. u should be showing us ur process.

  • show us how your UI & scripts are set up in the workspaceetc.
  • show us your code so we can give u relevant feedback on ur code.