ROBLOX is a user-generated gaming site. This means that users can make games which other users can play. ROBLOX allows you to use their game engine and scripting API to create games of all kinds that other people can play. The games are in 3D and use building blocks that could be accurately compared to Lego blocks. These blocks can be customized, resized, positioned and manipulated using the studio. Games can also contain various other objects, including particles (smoke, fire, etc) and graphical objects (text labels, buttons, etc), and users can write scripts to add more functionality to their games.
Most users on ROBLOX both create games and play games, but many only frequently do either of these. While most users do have one or many games they improve regularly and work on, most are not seasoned game developers and they see ROBLOX as a toy rather than as a game development platform.
Creating an accountEdit
You will need an account to create games and use the website. If you don't have one yet, you can create one easily. You need to navigate to the following URL with your web browser: https://www.ROBLOX.com/Login/Signup.aspx. There, you need to indicate your birth date and gender and to choose a username and a password. You will get a character: there are many ways to customize that character and use the social aspect of ROBLOX, but this book will focus solely on the game development aspect, although some of it overlaps with the social aspect. If you have never used the site before, you should explore around it enough to be able to find your way on it when you'll need to. You should also play some places (games on ROBLOX are frequently called "places") to see some examples of what can be done on ROBLOX.
You will need the ROBLOX client to play games (it can be downloaded on the site by clicking on any place's play button), and you will need the ROBLOX studio (which comes with the client) to create and modify games. Note that the ROBLOX software only works on Windows and Mac OS X. There are workarounds to make it work on Linux with Wine.
David Baszucki founded Knowledge Revolution, a company which concentrated on educational physics and mechanical simulation software. Erik Cassel joined this company and worked with David on the software. Keith Lucas, the current ROBLOX vice president of engineering and operations, also later joined the company, in 1997. Later, Knowledge Revolution was acquired by MSC Software Corporation, which they both left some years after to create ROBLOX, in 2004.
ROBLOX was launched in 2005. The name is a combination of the words "robot" and "blocks". It started with only some hundreds of users and, today, it has many millions of users, and it is still growing. This book will cover many features that were added to the game engine and scripting API over the years since ROBLOX's creation, but it will be impossible to cover them all because of their number.
This book will not describe the entirety of the ROBLOX website or even most of it, but only what is necessary to start working on creating games. You are encouraged to explore the rest of the website yourself. You can navigate through the site using the menu bar at the top of the page.
You can see your places on your profile, which you can find by clicking on the profile link in the menu. Unless you upgrade your account to a premium membership, you can only have one place (you don't need more than one place or any of the premium features to complete this book). You can also find your places on the places page or on the build page.
The ROBLOX Studio, which should have been downloaded on your computer when you installed the ROBLOX client, is a tool used to create ROBLOX places. Once opened, it should display a page on the ROBLOX website. You should log in from that page (it is not necessary to log in to use the studio, but some features require it). Once logged in your account, you can open a new place by opening the File menu and choosing New. You can also edit one of your current games by browsing to the game's page on the website and clicking on the game's edit button.
If you can't find a panel, open the View menu and click on the corresponding button to make it visible.
The game view displays the current game environment. When you open a new place, it should look like an empty sky and be in the middle. It will display your game in the same way as the players would see it when playing. You can move the camera by using the arrow keys.
The explorer panel, commonly called the explorer, is a panel that displays all the objects currently in the game in a hierarchy. Clicking on an object in the hierarchy will select it. An object that is included in another is called a child of that object (the terrain object is a child of the workspace) while an object that includes another object is called the parent of that object (the workspace is the parent of the terrain object). An object can have many children, but can only have one parent.
You can perform many actions on an object by clicking on the corresponding button in the object's context menu (which is shown when right-clicking on the object). You can also move objects by dragging them into another object (some objects cannot be moved).
The property panel is a panel displaying the properties of the object that is currently selected. Properties are values that you can modify to change the behavior of the object.
There are many object types. These are called classes. Not all classes have the same properties, however, all have certain properties in common. The ClassName property is common to all objects, and its value is the name of the class of the object. For example, the class of a part would be "Part". The Name property is also common to all objects, and its value is the name of the object. Each object needs to have a name. The Parent property is yet another property common to all objects, and its value is the object the current object is included in.
The toolbox is a panel allowing you to insert models fabricated by other users. These models, also called "public domain models" or "free models" can be searched for with the toolbox. There are also models featured by ROBLOX. Your own models (you can publish your own models for other people to use) are also shown in the toolbox.
The basic objects panel is a panel allowing you to insert objects into the game hierarchy by double-clicking on the item's name. The object will be inserted in the object that is currently selected. The panel will display the available items in columns. If the checkbox is checked, it will select the object automatically after it is inserted. You can also search for a specific object using the search bar at the top of the panel.
The command bar is a toolbar that can be used to run short lines of code. It is frequently used with the output to see the result produced by a certain piece of code. It is also frequently used to automate tasks in your game or to do things that cannot be done with the studio's interface.
The output is a panel that displays output generated by scripts, as well as warnings and other information from the engine. It is an essential tool for finding errors in scripts and correcting them. It can also be used together with the command bar to execute code and see the result.
The script performance panel is a panel that displays information concerning the performance of the scripts running in the game. Scripts labelled as "[Unknown]" are usually either core scripts (internal scripts used by ROBLOX) or removed scripts, so they can be ignored. While the script performance panel isn't frequently used, it can help identifying scripts that are expensive in performance and it can be useful when evaluating the performance of a script.
The diagnostics panel is rarely used, but it is useful to know about it. Most of the information in it is very technical and useless to the average user. It can tell you the number of parts in the game, the number of connections handled by the physics engine, the frames per second (FPS) and some other things, but this information will rarely be needed.
The standard toolbar can be used to perform various actions. The buttons in the first section of the toolbar can be used to create, open and save files. The second section can be used to cut, copy and paste game objects (or text in the case of a script). The third section can be used to undo or redo actions. The fourth section can be used to group or ungroup selected objects into models. Finally, the fifth section can be used to tilt, rotate or change the height of parts.
The camera may be hard to get used to for a person who has never used it before. It is possible to unzoom with the mouse wheel or the I and O keys. The camera can be moved forward and backwards by using the up and down keys or the W or S keys. It is possible to rotate the camera by right-clicking and dragging the mouse.
There is also a toolbar for manipulating the camera. The camera toolbar, illustrated above, can be used to manipulate the camera. The two first buttons can be used to pan the camera left or right, the two next ones can be used to tilt it up or down, the two that follow can be used to zoom in or out and, finally, the last two ones can be used to zoom into the currently selected part or to zoom to the center of the currently selected part.
The game hierarchy is the hierarchy of objects in the game. It can be seen and manipulated through the explorer, as explained above. Top-level objects (objects that have no visible parent in the explorer) are called services. Not all services are shown in the explorer (in fact, many classes are hidden by default).
The workspace is the place where all the scripts (the objects that allow you to run code in your game) and the visible parts (parts are also called "bricks" or "blocks") in your games are located.
The Players service is the place where Player objects (objects that represent players) will be located. You don't need to worry about this service right now, as you will only use it when writing scripts.
The Lighting service is the place where skyboxes, which give a different appearance to the sky, are stored. It also carries many properties that can be modified to change the lighting of the place.
The StarterGui service contains GUIs, 2D elements that you can put in your game to create menus, buttons, etc. The GUIs contained in this service will be given to players when their character spawns. Without scripts, not much can be done with GUIs, so this book will not talk again about them until later, when we get into scripting.
The StarterPack service contains tools. Tools are used by players to do things. For example, a sword would be used to attack other players, a key would be used to open a door, etc. These tools will be given to players when their character spawns. Again, without scripts, you can't do much with tools.
The ROBLOX studio offers many ways to test games that are built with it. When a game is being edited using the studio, it is in an idle state. This means that the physics are disabled and that scripts are not running. It is possible to run the game by clicking the run button, which is the first button in the toolbar shown above. This will enable the physics and make all scripts run. The game can then be stopped by clicking the stop button, which is the second button in the above toolbar. The reset button can be used instead of the stop button to reset the game to its previous state and stop it.
Often, these will not be enough, and, instead, testing in-game will be necessary. For this, there are three options. The first is to test the game online. Unfortunately, this requires to publish the game online and to play it, which can take some time and does not give you access to an output and all the debugging tools available in the studio.
The second option is to use the "play solo" testing mode. Testing modes are available in the Tools menu, in the Test section. The "play solo" mode will create a pseudo game environment with the output and the full studio. It gives the user a character and runs the game. However, this testing mode has many differences with a real game environment and, sometimes, scripts will not work in it or, worse, only run in it (which happens often and really makes finding errors painful).
The third option is to use the pseudo server testing mode (which corresponds to the "start server" option in the menu), which creates a pseudo server on your computer. It then allows you to create players (using the "start player" option). It will also give you full access to the studio and, unlike the "play solo" mode, give you a normal game environment. However, some features like badges or data persistence (both will be explained later) can still not be used in it, and using it takes more time than the "play solo" mode to use.
You will probably not need to use any of these testing features until you start writing code and encountering errors.
The game currently opened can be saved either by using the standard toolbar or the File menu. Games are saved with the '.rbxl' extension and use a binary format. They previously used a XML format with the same extension. The legacy XML format is still supported, and games can be saved in XML with the '.rbxlx' extension. They can be opened again by using the open button in the File menu or the standard toolbar. Files saved on a user's computer or created in the studio can be uploaded to the website with the "Publish to ROBLOX..." option in the File menu. Games opened directly from the website will prompt the user to save before closing.
In virtual worlds on ROBLOX, there are different types of objects that appear physically.
The most common physical object on ROBLOX is the part. Parts are also called bricks and blocks. They can have three shapes: the shape of a block, of a sphere, or of a cylinder. The shape of a part has an affect on how it behaves physically. Cylinders behave physically like spheres because simulating a cylinder is too expensive in computer resources and would slow down games that use cylinders extensively.
The appearance of parts can be customized with materials. The default material for parts is the plastic material, which makes the parts have a homogeneous color with a slight concrete appearance; the smooth plastic material can be used to have a perfectly homogeneous color. The plastic material is fine for some cases, but more customization can be needed to improve the look of buildings. Materials, when applied to a part, change the texture of that part. They also change that part's density, which has an effect when the part is put in water terrain: parts of some materials (like wood) will float in water while parts of other materials (like slate) will not.
The fifth button of the customization toolbar can be used to change the material of a part. It allows you to pick the material you want from a list of available materials and then to click on parts to apply that material to them. There aren't many materials, but they are sufficient for most purposes. Custom textures, which are described some sections below, can be used when more customization is wanted, but are less common.
All parts have a form factor, which defines what sizes the part can take. The default form factor is the brick form factor, which requires the height of the bricks to be a factor of 1.2. The symmetric form factor requires all the dimensions of the block to be factors of 1, while the plate form factor requires the height to be a factor of 0.4. The custom form factor allows a very low factor for all dimensions.
Each surface of a part has a type. By default, the top surface has studs on it and the bottom surface has inlets on it. There are 11 surface types. Surfaces can form bonds with other surfaces, which allows parts to stick together and not fall where they normally would due to gravity. They also affect the appearance of the part if the part's material is plastic. Otherwise, the material texture is used instead of the surface texture.
The behavior between the surface types is described in more detail in this table:
Decals and texturesEdit
Decals are objects which can be put on the surface of a part to display an image on that surface. They are useful for billboards, ensigns, flags and in-game screens. When a image should be displayed for the purpose of changing the appearance of the surface, a texture can be used instead.
Textures are the same thing as decals, but the image is repeated instead of being scaled to fill the entire surface. This gives results that are far better than what can be obtained by using a decal, because the quality of user images on ROBLOX is restricted.
If you want a sign that shows an advertisement, you should use a decal. If you want to put a brick texture on a wall, then you should a texture. Texture objects, like all other objects, including decals, can be found in the basic objects panel.
Games sometimes need to contain objects that are more complex than simple blocks, spheres and cylinders. Meshes can be used for this purpose. They are objects that can be put in parts and that, when put in parts, make these parts have a different shape that can be very complex. There are some predefined meshes, and many others that are uploaded on the website. All hats and gear in the catalog, for instance, use meshes for their appearance. Meshes by themselves have no color or texture, and only a shape, but they are generally given a texture. Meshes only have an effect on the appearance of the part they are used with, but the part's physical behavior is still defined by its shape and surface type. Because of this, meshes are best used for small objects, or objects that are out of the reach of the players.
Meshes do not support outlines. They can be scaled and moved away from their physical part (using an offset). Scaling is necessary because their size is not adapted to the size of the physical part. Moving it away from the physical part can be useful to create hologram effects and other similar effects.
Parts can contain particles of different types. It is not possible to create custom particles, but many predefined types are provided and offer some properties that can be customized.
Sparkle objects can be inserted in parts to make sparkle-like particles appear and move from the inside of the part to the outside of it, and then disappear at some distance. The color of these sparkles can be customized.
Fire objects can be used to make fire particles appear over a part. Fire does not necessarily need to be orange or red, it can be of any color. Its heat (the longevity of the particles) can be set, and so can the color of the particles when they are close to disappearing.
Smoke objects can be used to make smoke appear over a part. Smoke will generally go up, but it can also go down: it will go in the direction of the top surface of the part it is located in, so by changing the rotation of the part, it is very possible to make smoke go to the left, or in any direction. The color of smoke can be changed, and so can the velocity at which the smoke rises. The size can also be changed, as well as the opacity.
Trusses are mostly identical to parts, but have a different appearance, can be climbed by characters, and have size restrictions. They must always have a width and depth of two studs, while their height is unrestricted. They support materials, surfaces, and everything parts support with the exception of decals and textures. They are available in three different styles: without supports, with alternating supports and with bridge-like supports.
When a character is standing next to a truss and starts walking in its direction, he will start climbing the truss in the same way he would climb a ladder (when many parts are stacked with a small gap between each of them, characters will go up when walking in the direction of the stack of parts). This also works when many trusses are stacked in their horizontal position. Sometimes, it will be desirable to put many trusses together to make climbing them easier. However, in many cases, it may be desirable to use a ladder instead of a truss, as trusses are primarily real building materials, rather than tools used to climb structures, which is the purpose of ladders.
Spawn locations are identical to parts and behave in the same way, with the exception that characters can spawn on top of them. Spawn locations can be configured so that only players in a team will have their character spawn on them. They can also be configured to make a force field appear around the character of users who spawn on them for a limited amount of time to prevent characters who have just spawned from dying immediately.
The number of parts that can be used in a game is limited by the computer resources available. Terrain can be used to create beautiful and complex landscapes that it would not be possible to create using parts because of the limit of the computer resources. Terrain is implemented as voxel terrain. Voxels are atomic volumetric units that can be thought of as the tri-dimensional equivalent of pixels, or simply as cubes. These cubes can be put together and given a different appearance.
Terrain cubes currently have a material, a shape and an orientation. Unlike parts, they are not objects, are not visible in the explorer and can not be grouped into models. However, you can have millions of them on an average computer, while parts on average computers are limited to around one hundred thousands, at which point the game is very slow.
Terrain is usually created using the terrain toolbar, which is shown at the top of this section. The first tool in that toolbar is the terrain generator, which is used to generate terrain. The two tools that follow are used to create and destroy individual terrain blocks. The next two are used to change the elevation of terrain in various ways. The following one is used to create craters. Then, the one that looks like an intersection of roads is used, precisely, to create roads. The one that follows is used to insert terrain blocks (and also other things), and, finally, the last one is used to fill an area with terrain (and it is really useful to create lakes with water). Each of these tools has its own integrated help which is available by selecting the tool and clicking on the button with an interrogation mark on it, so they will not be described here.
Seats work identically to parts, but players can sit on them. There are many types of seats: simple seats, vehicle seats and skateboard platforms. Simple seats are simply parts that users can sit on. Scripts can be used to make these seats have various functionality. Vehicle seats are used to create vehicles that work with a motor and wheels and that can be controlled by the user without any script being needed. Skateboard platforms, finally, are used to control vehicles that are generally smaller (hoverboards, skateboards, surfboards and generally anything that describes a vehicle and ends with "board") and easier to control. Skateboard platforms need scripts to work, but handle the animations that happen in different events, such as when the character on the skateboard platform turns, jumps, accelerates and so on.
Building, on ROBLOX, is the art of putting physical objects together, manipulating them and customizing them. The studio offers many tools to facilitate this process. By being able to change the size, position and appearance of parts and other physical objects and putting them together, it is possible to build almost anything. From small buildings to very detailed rooms and to complex mechanisms, it is possible to create a lot of things.
Models are used to group together parts, scripts and other models. They are indispensable for organization. A big game without any organization can quickly become very hard to maintain, so you should always use models to organize objects in your game. When many objects together form something bigger, they should be grouped together (a bed, a house, a car, etc). Parts can be grouped and ungrouped by using the explorer's context menu or the group and ungroup buttons in the Format menu (as well as the corresponding keyboard shorcuts). You can also use the corresponding button in the Format menu to select all the children of a model, which is very useful in certain cases.
For example, suppose you were building a tower, like the one on the right. Suppose it had a door and stairs to get to the top. You could group the parts that form the stairs together and do the same for the parts that compose the door. You could group the parts that compose the ramparts together and you could group all of the rest into a model called 'Walls'. Then, you could group all of these models together and call that model 'Tower'. The place would then surely be better organized than it would be if you had just kept all these parts scattered around without any organization!
Manipulating parts consists of moving, resizing and rotating them. In the studio, manipulation of parts is usually done by using the toolbar shown above.
- The first tool can be used to select parts by clicking on them and to move them, by dragging the mouse once they are selected. Parts can also be selected and dragged by using any of the other tools.
- The second tool can be used to move parts. It works like the first, but also shows dragging handles, which allow you to move a part on a particular axis.
- The third tool can be used to change the rotation of parts. This one is a bit harder to use, but it should still be easy: just use the handles to change the rotation of the part.
- The fourth tool can be used to change the size of parts by using the handles and dragging them, the same way as you would move the part with the second tool.
- The three buttons following the separator are used to change the grid used and the increment when moving, resizing or rotating the part. The best way to learn to use them is to experiment with them.
- Finally, the last button allows you to choose whether parts should be welded together when moved on other parts. If it is enabled, then parts will stick together. Otherwise, they will not stick together and they may fall when the game runs.
ROBLOX uses a unit called 'studs' for positioning and calculating distances. A stud is the equivalent of one of the squares with the R logo in them on a part. A meter is equal to 20 studs.
Customizing parts consists of changing their appearance and behavior. Like manipulation, it is, in the studio, generally done by using a toolbar, the toolbar shown above. Some customization can only be done by changing properties manually from the property panel.
The first button can be used to anchor or unanchor a part. Anchoring a part means setting its position so it will not change due to gravity, collisions or other physical events. Anchored parts can not move in a running game unless their position is modified by game scripts, but they will collide with other parts, meaning characters can walk on them, for example.
The second button can be used to lock or unlock a part. Locking a part makes it unable to be manipulated by building tools, both in the studio and in building games. This can be useful when you don't want players to be able to manipulate certain parts in a building game and it can also be useful to prevent yourself from moving a part by mistake.
The third and fourth buttons are used to change the color of parts. The first allows you to choose the color in a color palette, while the second allows you to pick the color of an existing part by clicking on it.
Finally, the fifth button can be used to change the material of a part, by picking the material you want from a list of available materials.
If you take a look back at the tower presented in the section about models, you notice it uses a lot of parts in its walls. While this isn't exactly bad, in order to make the game faster (by reducing the number of parts), it is usually better to use a texture of repeated bricks.
In addition to all the toolbars, the studio also offers additional tools for building. In addition to some options available in the menu, there is an axis widget that can be used to quickly find the position of the X or of the Z axis, and there is a 3D grid that can be used to quickly find the height of the position zero and to build parts on it. These two tools are rarely used, but they can be useful to identify which axis is the X axis and which is the Z axis. All part customization and manipulation can also be done directly by editing the properties of the parts with the property panel after having selected them.
ROBLOX has many help sources where users can get help on various subjects. One of these is the forums, where users can ask questions. There are two help forums for game development:
Before posting in the forums, users can check many other online help sources. The first is Builderman's help, which can be found in the website's menu (the Help button). It contains information about the website, the rules and various other things.
The main information source, however, is the ROBLOX wiki. It can be found through some links hidden on the website or by pressing F1 in-game. The wiki, written by editors selected by ROBLOX staff, contains documentation about building and scripting. It is a very useful source of information and documentation for ROBLOX.
There are some questions you can answer to verify that you have understood the material in this chapter. Note that finding the answer to some of those questions could require having knowledge that is not presented in this chapter. This is normal: the quizzes are part of the learning experience, and they can introduce information that is not available elsewhere in the book.
Scripts, which can manipulate game objects, are contained in objects that are part of the game hierarchy. There are three kinds of scripts: server scripts, local scripts, core scripts and starter scripts. They respectively correspond to the class of the names "Script", "LocalScript", "CoreScript" and "StarterScript". Server scripts are scripts that run on the server while local scripts run on a player's client (the client in question depends on the local script's location in the game hierarchy). Core scripts and starter scripts cannot be used by game developers and are internal to ROBLOX.
You can create a script by using the basic objects panel in the studio. Find the class name of the script you want and double-click on it to insert the script. Scripts will not run everywhere; while there are many places where they can run, most of the time, you will want to put them in the workspace service. Once the script is inserted, it can be edited by double-clicking on it in the explorer panel. This will open a new tab with a script editor, where code can be put. It can then be executed by closing the script editor and running the game with the green run arrow located in the testing toolbar.-