You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear! How to make this code better and not look repetitive
What is the issue? I need help making this code look better. I want to get better at programming.
What solutions have you tried so far? I have lack of knowledge of how to organize my code in StarterGUI
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
I think you can organize the code a little better by replacing commas for numbers as dots. Small change, but huge difference(s). You should preferably try learning for i loops and see if you can utilize it efficient enough to conveniently repeat the wait process instead of manually repeating wait(0.001). I advise you to use task.wait(s) for more precise time management in any of your future scripts or programs. You can just enable loadingscreen ScreenGui as a whole and leave the visibility of the children of main true for convenience as you don’t have to worry about it. Most importantly, you might as well refer to this Roblox Lua Style Guide from Roblox themself. It’s pretty helpful!
Here are the benefits when using dots and commas as they were to be in Lua.
Using dots should be only when you are trying to insert decimals. As you get involved into the programming industry which is popularized by mostly America, you will have to use dots to insert decimals. This excludes .. which is just connecting variable of any type with another variable. In addition, this makes it easier to read as many programmers you will come across are from America or other English-speaking countries. It is also recommended to be consistent with using the same symbol to represent the decimal. Lua will mostly not recognize wait(0,5), but rather wait(0.5), so using dots for decimals are mandates.
Commas, on the other hand, are often used a separator. I don’t know how to explain well, but a Roblox cloning function would be part:clone("Name", Parent) (not recommended to add parent though, only used as an example). You can see how it separates between two inputs, but there can be more.
This based off of my theory and understanding. You can visit this page of the Lua Documentation for examples though.
Another way to link chunks is with the dofile function, which immediately executes a file. For instance, you may have a file lib1.lua:
-- file 'lib1.lua'
function norm (x, y)
local n2 = x^2 + y^2
return math.sqrt(n2)
end
function twice (x)
return 2*x
end
Then, in interactive mode, you can type
> dofile("lib1.lua") -- load your library
> n = norm(3.4, 1.0)
> print(twice(n)) --> 7.0880180586677