Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

How do I get started scripting in Lua if I'm not familiar with scripting at all?

Asked by 6 years ago

I'm kind of a developer, but I only know how to build. How can I get started with scripting in Lua? (e.g. tips, tricks, guides, etc.) Any advice is much appreciated!

0
im trying to figure this out too, APersonThatsBored 0 — 6y
0
This is a very interesting question. I would like to see different answers to this question saSlol2436 716 — 6y

2 answers

Log in to vote
5
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
6 years ago
Edited 6 years ago

The best way, and I do mean the best way to learn, "how to script" is to learn from books. There are various kinds of programming books found in the internet. A simple google search will open the doors to your programming journey.

Now learning how to program is not easy at all. Programming consists of concepts and concepts. By the time you are a master scripter, you will be old. But to begin to program, I highly recommend you actually learn what programming really is. Although it is technically fine to not know much about it, I still recommend you know what it is.

What's the point of eating an apple, if you don't know what apple would do to your body.

  • Basic idea of Programming

    In just a simple line, programming is basically taking in algorithms, implementing it in the compiler, executing the code through the compiler and presenting it. It is way deeper than that. Although you may not benefit immediately from it, it will greatly help you in long run.

The next question you want to ask yourself is:

  • "What programming language does Roblox use?"

    Roblox uses a light-weight programming language called Lua, more specifically, Lua 5.1. It was first created in a University of Rio-de janerio, in Brazil. It is known for its speed, portability and ease-of-use in developments.

    Actually, Lua is the perfect place to begin learning how to program because it is so easy to use compared to other programming languages for example, Java. Java was my first programming language, and let me tell you, it was not that easy for me. I was pretty young at that time, and I had to spend weeks just figuring out what public static void main(string args[]){} even meant! Lua needs none of that. You can just go right into it without declaring any classes which is pretty amazing.

  • How to actually start learning Lua?

    When I said jump right in, no I do not mean go right away and make a game. Before you do any of that, you need to have some idea on Roblox Studio and its features it provides. You need to be able to insert a part, change its properties, make a basic chair, or some kind of Graphic User Interface (GUI), etc. Basically, what I mean is that, get familiar with the studio panels, know how to import and export files, plugins, and etc. Even though Roblox does use Lua 5.1, it also contains its own features called Roblox API. Some of the things included in this API are Click Detector, Remote Events and Functions, Bindable Events, Local Script and etc. You need to be educated in those fields before you become a Game Developer.

  • What sources should I use to learn Lua?

    This is a very good question. The answer is most definitely obvious. Books. Simple because you learn at your own pace which is most of the times comfortable for you. I do not recommend you rely on youtube videos for tutorials. This is mainly because, if you learn from youtube videos, you are forced to learn from the youtuber's pace. You may have had a misunderstanding of a concept which the youtuber could potentially have worded it wrong. Books are generally approved by a team of experienced people on the particular fields. Therefore are much more reliable. I am not saying do not look at youtube videos at all. Use it as a way to check if your understanding is correct or you want to see how someone else approached the problem. Books usually give you a straight example but there can be various ways on how to write it differently. Definitely check out youtube videos to see how other people approached this problem because every person in this world think differently.

  • How should I begin to code?

    Write Algorithms. It will help you a lot in the beginning. Of course this is a debatable topic. And I can understand why. Once you become an experienced programmer, you can automatically think of ways to solve a problem. But when you are a beginner programmer, solve a large chunk of problem can be quite overwhelming to think about. This is why algorithms are so great. It helps us break down problems into smaller bits. Lets say I want to Buy a pizza. Here is what my algorithm would look like.


-- Call Pizza Store;
-- Greet;
-- Ask for Menu;
-- Get Menu List;
-- Check Pizza;
    -- If there is Pizza then;
        -- Order Pizza;
        -- Pay $ Amount;
        -- Wait;
        -- Get Pizza;
        -- Leave;
    -- If there is not Pizza then;
        -- Leave;

Now, the cool thing about writing algorithms is that it keeps playing around in your head. What happens if the store closed when I walked right in? What happens when I order pizza and I found out I don't have correct amount of money? These are all the bugs found in our algorithms. We would have to keep fixing the algorithms until it has no bugs. Once your algorithm is over, all you have to do now is to type it up, following the syntax. If you stop and think about it, this step really is important when dealing with big amount of problems, because you want your program to run smoothly.

  • What do I do If I cannot solve it? Of course everybody makes mistakes. No one can master a programming languages in a single day. It takes time and time and time. You make mistakes and you learn from them. You first try your best to solve it. Try another way. If you still can't solve it, google the error you receive. See what the error's meaning is. Look at your code and see if it is an obvious mistake. Asking for help is something you should never be afraid of. Maybe you are writing a program in a very inefficient way. Of course the computer does not care how bad your code is. However, the reader, which is you also, should care about it.

    If you still cannot solve your problem, post it here, just like you did. We will always do our best to solve your problem. This is what this website is for. Its not for writing a chunk of code for you. It is for guiding you to correct path. Remember to always stay motivated. If you are not motivated, you will start to hate programming a lot. Remember to take breaks and not work your butt off. I will close of this long-boring essay with some resources which will definitely guide you.

  • Lua 5.1 Resources

  • Roblox API

I look forward to see how you progress. Have fun programming.

Ad
Log in to vote
2
Answered by
Ribasu 127
6 years ago
Edited 6 years ago

You can follow Roblox scripting tutorials and just get creative with your experiments. You will find that this is not very difficult if you adopt the mentality that you are just using the Roblox Studio/builder (e.g. moving bricks, adding new colours, changing sizes, changing things from explorer window...) but you are automating the process rather than taking a manual approach. This will get you the basics and you can do a lot with this info.

Eventually, if you want to get really serious, you would need to learn about design, ways to organize your code, software engineering and graphics... but this is the stuff you get from a course from college or a good book and might take some years to master. What this means is that eventually, you become so comfortable with the basics of scripting that you started planning and managing your efforts rather than taking a 'trial-and-error' approach. In my opinion, a good programmer needs to reach a point where they start using techniques such as UML, state transition and even more formal ways to reason about what is going on. I guess you could say that you end up thinking more about your projects from an abstract perspective. In time, the programming becomes secondary. So far, in my time on Roblox, I have never seen anyone use such techniques, so there is a lot of space to become a respectable programmer. I would recommend that once you feel comfortable with the basics and are ready to take a step further, that you immediately study the Lua specifications (for example, quickly skim through the latest Lua Reference), and then pick up books on graphics or software engineering (PM me if you want my recommendations). Also, stay subscribed to developer forums such as the one you are on right now (ScriptingHelpers), Roblox Dev and StackOverflow.

By the way, once you start working on big projects and you start working with a team rather than by yourself, then, scripting becomes a whole different beast, and in my opinion, Roblox does not have the tools to manage this problem. To be fair, working with people is a challenging problem everywhere though.

TL:DR; Programming and scripting is very easy to get started with, the difficult part is good design and engineering (e.g. for extendability and performance among others) for which I would recommend to get into academia for, and/or read a good book.

Answer this question