I’d like to preface that I’m more of an intermediate and a complete solo developer; I’m not a master programmer just yet and have not formally worked with a team before, only cohorts with my friends. But I’ve gotten to the point that I can more or less create most ideas I can think of from scratch.
I first learned through scouring through scripts made by people more experienced than I, and editing them to achieve the results I wanted. With that, I was able to create my first few projects that were mostly a patchwork of different scripts heavily edited into something that was ultimately my own work. That was how I first got off my feet, but I understand if you would rather do everything from scratch on your own. But from my experience personally, I have never touched a scripting tutorial. I was hands-on my whole journey. That may not be the best for everyone, but it’s how I learned.
When I started making my own systems from scratch, though, I often ran into the issue of coding myself into a corner with bad practices and burning out on a project. That hemmed me into a mindset of fear and burnt me out on game development as a whole for a while.
In my opinion, though, just creating something is significantly more important than worrying yourself to death about all of the ways you could be messing up. Sure, when you’re moving into the world of advanced scripting and undertaking a project that you really don’t want to screw up, especially when working with other people, it’s best to take it slow and understand the implications of everything you’re working with. But for learning, I’d say that prioritizing momentum and experimentation is key. Taking things as they come is the best teacher I had.
If your code has redundancies or is messy at first, oh well. You understand how it works and why it works, and that seems to be what you’re pursuing. Fluency and good habits come with time.
As for some simple suggestions, here are a few:
- Space your code out more if it helps you understand it better. If you like it compact and with a lower line count, you can slim it down too. Just format it in whatever way works for you.
- Annotate your code. Even if you aren’t working with anyone else and no one will ever even glimpse your code, annotate it. I’ve found it’s a great practice for comprehension, and if you need to return to this script at any time in the far future it’ll help you get right back into it. If you don’t know how to annotate, just type like this at any point in your code:
-- Your text here
--[[
Or your text here
--]]
- Practice good garbage collection. If you create an object in your code that is going to later disappear, then make it disappear. It sounds silly, but it’s surprisingly easy to create lag after a server has been up for a while when there’s a bunch of still-defined objects sitting around in post-use limbo and not being used.
- Put checks in your code, it never hurts. Checks of any kind, but personally nil checks were what messed me up. You might save your game from a server-ending error if you just code “if this object exists, then do this with this object” instead of just “do this with this object.” You’d be surprised, stuff can sometimes just stop existing.
if part ~= nil then -- if this part is not nil then
-- your code with the part here
else
-- if the part doesn't exist, handle it
end
--[[ if you didn't run that check and just tried to run your code for
the part and it was nil, you'd have gotten an error that could have
compromised your code. --]]
- Finally, Roblox documentation and the devforum are lifesavers. As tempting as AI is, I’ve found that long-term, the devforum teaches you much, much more. Of course, when I was in the bulk of my learning, AI wasn’t available… but still, like I said, I have a ways to go as well with programming, and have used both. This is just what I think.
I hope that this helps. Whether it does or doesn’t, here’s a devforum post that might help you further whose author is probably a fair bit more eloquent than I.
Good luck on your journey. We all believe in you.