✓ Accepted answer
Some points:
- Most functions shouldn't need 8 arguments
- 8 arguments in a single function will be faster than spreading those arguments out to multiple functions, but the difference will be so small you shouldn't worry about this -- in fact, you should consider spreading them out if it makes sense to. Let each function be responsible for a small task rather than several tasks, both for organization purposes and so that it's easy to verify that a function is doing what it's supposed to just by looking at it.
- "...would slow down the current thread" - have you tried this out and that's what you found? Are you using the RunService?
- "...and needs to be in time with the music"
One of the most useful guidelines is "DRY" - Don't Repeat Yourself. So long as you aren't repeating yourself, you can get a lot further than if you have repeated code everywhere (since then you only need to make changes to one place).
As Color3fromRGB says, you may benefit from looking into Lua objects or by looking up Object Oriented Programming (OOP). There are numerous best practices (for OOP and for coding in general) that you can look into (ex here: https://www.quora.com/What-are-some-good-coding-practices-a-developer-needs-to-follow, though some aren't as relevant to Roblox)
"In my case, what parts should be hardcoded/softcoded?"
In general, anything you expect might change in the future and anything that is easy to softcode should be softcoded. For example:
- Always assigning a literal number to a variable and refer to the variable; this enables you to easily change it in a single place later (and also makes it easier to understand -- "50" means less than "NotesPerSong", for instance)
Though you probably aren't anywhere near this point, I've recently fallen into sort of the "opposite" trap: writing functions before I've actually repeated myself (trying to save time); I usually end up with functions that do the wrong thing (ie they work for the first case, but not the second). This can be avoided by waiting until you have an actual instance of repetition before writing a function or class for it.
2 comments
you decide LoL
You should cobsider messing around with "objects", as all the required code can be neatly within it, with no hardcoded functions.