Cookbook

From Legacy Roblox Wiki
Jump to navigationJump to search

Author

The entire cookbook was written by Camoy.

Preface

The RBX framework for Lua provides an API for creating 3D games for the ROBLOX game. The API has a vast variety of functionality such as functions for moving in game players to properties controlling custom in game GUIs. The API is easy to use and is quite powerful. This book will cover the basics of the framework and what you will need in order to start programming your own ROBLOX games.

Getting started is easy, just head on over to the download page in order to download the ROBLOX IDE (called Roblox Studio), and the browsing client.

This book assumes a prerequisite knowledge of Lua, however if you do not know Lua at all, don’t turn this book away yet. There are many good resources in learning Lua (one especially helpful resource is here). Even if you have no prior knowledge to Lua, in the early chapters, simple Lua syntax will be explained.

The documentation for the ROBLOX framework can be found at here, at the wiki. Under the “Building and Scripting” category, you will find a link to the “Scripting Reference” and the “Class Reference”. The “Scripting Reference” page is an index of the many scripting articles already written on the wiki site. You may find it useful to check out some of these articles as well. Under the “Class Reference” section, you will find all the ROBLOX objects and will be able to interactively explore their properties, methods, events, and general information. The ROBLOX IDE also has an “Object Browser” (found under Help --> Object Browser), however this is not as comprehensive as the wiki documentation.

In general, this book will provide solutions and examples of many types of problems you may need to solve when building a ROBLOX game. The difficulty level progresses as the book progresses. It is suggested that you read the book cover to back, however if there a certain solution that you need, feel free to jump to it.

Table of Contents

  1. Basics
    1. Part Instantiation
    2. Color and Transparency
    3. Applying the Touched Event
    4. Killing Players
    5. Removing Limbs
    6. Handling Non-Existent Objects
    7. Creating a Kill Brick
    8. Removing Multiple Limbs
    9. Removing All Character Parts
    10. Killing All Players
    11. Killing Random Players on Interval
    12. Using an Exception Table
    13. Killing Spawning Characters
    14. Creating a Message
    15. Debounce
    16. Creating a Clickable Part
    17. Touch Activated Explosion
    18. Dance Floor
    19. Creating a Healing Part
    20. Creating a Restricted Access Door
    21. Creating an Invisibility Part
  2. Positioning
    1. Positioning Types
    2. Simple Part Positioning
    3. Overlapping Positioning
    4. Simple CFrame Positioning
    5. Rotating Toward Another Position
    6. Rotating in Radians
    7. Rotating in Degrees
    8. Relative Positioning
    9. Getting Relative Position
    10. Using the Rotational Matrix
    11. Using Lerp
    12. Simple GUI Positioning
    13. Centering GUI
  3. GUI
    1. Introduction
    2. Text Label Instantiation
    3. Text Style
    4. Frame Styling
    5. Image Instantiation
    6. Creating a Button
    7. Creating a Fading GUI
    8. Text Box Input
    9. Using Adornment GUI
    10. Creating a Resize GUI
    11. Creating Custom 3D GUI
  4. Beyond the Basics
    1. Using BrickColor
    2. Using Color3
    3. Using Base Classes
    4. Using Enumerations
    5. Event Members
    6. Disconnecting a Connection
    7. Using LocalScripts
    8. Creating a Regeneration Button
    9. Creating a Template
    10. Creating a Leaderboard
    11. Creating a Point Earning Button
    12. Applying the Chatted Event
    13. Applying the Changed Event
    14. Applying the ChildAdded/Removing Event
    15. Descendants
    16. Creating a Marquee
    17. Using a SpecialMesh
    18. Using a VehicleSeat
    19. Using Fire
  5. Tools and HopperBins
    1. Introduction
    2. Creating a Reset
    3. Kill Tool
    4. Key Controls
    5. Creating a Sword
    6. Creating a Kick Tool
    7. StarterGear
  6. Service Level
    1. Introduction
    2. Using GetService
    3. Getting Server Time
    4. Using Lighting
    5. Awarding Badges
    6. Creator Badge
    7. Inserting Assets
    8. Retrieving IPs
    9. Setting Maximum Players
    10. Using Debris
  7. Moving
    1. Introduction
    2. Moving to a Position
    3. Moving in a Direction
    4. Rotating in a Direction
    5. Using BodyGyro
    6. Using Dampening
    7. Using Power
    8. Using BodyForce
    9. Using BodyThrust
    10. Simple Welding
    11. Weld Offset
    12. Simple Motors
    13. Motor Speed
    14. Joints
  8. Miscellaneous
    1. Local Parts
    2. Using CameraSubject
    3. Reflection Metadata
    4. Testing Chatted Event

Let's get started!