Introduction

From Legacy Roblox Wiki
Revision as of 08:08, 30 October 2008 by >Sjom12
Jump to navigationJump to search

Welcome!

Although ROBLOX might take this off, I thought it might be nice to create a step by step series for scripting. If you have any questions, please talk in the discussion part of this page, or you can post your question in the ROBLOX forums. And guys at ROBLOX, if I put this is the wrong place, please lead me to put it in the right direction (thought this would be the best place).

General Background

The general thing here is that many people want to learn how to script in ROBLOX. I'm here to tell you that scripting is an amazing thing and you can learn a lot from it. Respect ROBLOX greatly for allowing you to (being technical) "mod" their game.

Why Scripting?

Well, scripting is an amazing thing as said earlier, but can be a bit frustrating if you don't know what you're doing. That's what scripting lessons are for. These scripting lessons are going to tell you everything from creating a door to the most complicated piece of scripting you have ever created.

Scripting at a Glance

Scripting in ROBLOX is using a language we scripters call "LUA" LUA is the language inside ROBLOX that you see making the doors open and that awesome elevator that your friend just made. ROBLOX isnt just about building. If you believe that building alone will get you as far as Are92 in ROBLOX, you're wrong. Are92 had some pretty amazing scripts as well.

The Very Basics

The Function

The function is most of the time the part where all of your scripts will go. That is, if you dont have an event. What do I mean by event? There will be a vocab page in another part. The function can be named ANYTHING. You can create some extremely elaborate name if you feel like it. Here's an example of a function.

function OMGTHISISAFUNCTION()
--some script--
end

Did you notice the "end"? This is probably the most important thing to the function. This ends it. Its kind of like you have to close the cookie jar after you open it. Declaring the function, AKA "function OMGTHISISAFUNCTION()" is opening the jar, and the end is closing the jar. The script in the middle is the cookies. As we all know, the cookies are the best part.

The Connection Statement

The connection statement is the second most important thing. It's basically connecting your hand to the cookie jar. Your hand is your ROBLOXian, and the cookie jar is the brick with the script inside it. A connection statement will look something like this.

game.Workspace.Brick.Touched:connect(OMGTHISISAFUNCTION)

If you noticed, the name inside the parentheses is the name of your function. This is necessary to link to the function. If you're wondering what the "game.Workspace.Brick.Touched" is, it's the path to the brick's touched event. The touched event is obviousley ".Touched" and the brick's path is "game.Workspace.Brick." Notice that the game is the main, well, game and the workspace is all the visible stuff in the game. There are other components to the game, but we'll get to those later.

Wrapping Up

Well, there you go. The very basics of scripting are put there. I really hope all this information will be very help for everyone.