Best way to organize these scripts professionally

So basically, I have all these local scripts for each and every frame:

Ui:
image

Scripts:
image

Each and every script works for each frame. But I was wondering if there is an even shorter way to do this. I even tried using module scripts for any functions that may be the same but I’m still not happy with the result. Another one thing, whenever I put the scripts in StarterPlayerScripts only runs once and if I reset nothing works. Does anyone have any ways to fix this? (I put it in StarterCharacterScripts for now because it still works when you reset.)

2 Likes

I really would use folders, and I feel it’s somewhat inefficient to have so many scripts, try using 1 or 2 main scripts to control the UI.
Edit: (You could also go into the scripts and browse the forum for more efficient ways of executing a function or if your code is really that efficient.)

I’d try and make most of those scripts into 1 single script and use functions with each script’s piece of code inside a function and call them when you have to use that script.

1 Like

How would I do that exactly? Just merge them together you mean?

No, you would make 1 single local script under your module and just paste your code of the other scripts in it. (I’d suggest organizing it by adding a comment saying what each area controls)

Yea basically that but not always that good

1 Like

Yea for example I would make 1 or 3 scripts depending on the length like @DonKingFrog said it’s not always a good thing for the reason that if something errors it could be hard to find the code with a lot of lines so if 1 script goes more than I’d say 1-3k lines of code than make another one so later on you can find errors quicker. I belive that’s what real was trying to get out.

And also putting my scripts in StarterCharacterScripts wouldn’t make sense how would I put them in StarterPlayerScripts while fixing what I said above.

Yea that’s part of it, While true loops most of the time need their own script. because you can’t add anything under them if their out in the open.

1 Like

Well have the Screen UI ResetOnRespawn I believe it’s called that. (it should be in properties if not then have the script run when plr.CharacterLoadded. And StarterGUI should work on reset.

I tired that, it didn’t solve my issue. Basically, the scripts only work once but if I reset my character it would no longer work.

Well, something is up, idk if you’re doing it wrong or what but startergui should work on reset.

Could you show me your setup on what you did for that?

Well there are solutions to everything but suppose to work as @thyswedishviking says

If I want to make it more clear. I use collection Service for the button animations with a for i,v in pairs loop. But if I rest the uis the scripts won’t run again.

Did you put the scripts inside the Menu UI?

No, there in StarterPlayerScripts.

Try putting them there, because the scripts will load if the UI is loaded.

I was told it’s not good to put it in there.