Cookbook: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Emess
No edit summary
>Emess
No edit summary
(No difference)

Revision as of 05:52, 4 February 2011

RBX.Lua Cookbook

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 GUI. 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

  • Basics
    • 1.0 Part Instantiation
    • 1.1 Color and Transparency
    • 1.2 Applying the Touched Event
    • 1.3 Killing Players
    • 1.4 Removing Limbs
    • 1.5 Handling Non-Existent Objects
    • 1.6 Creating a Kill Brick
    • 1.7 Removing Multiple Limbs
    • 1.8 Removing All Character Parts
    • 1.9 Killing All Players
    • 1.10 Killing Random Players on Interval
    • 1.11 Using an Exception Table
    • 1.12 Killing Spawning Characters
    • 1.13 Creating a Message
    • 1.14 Debounce
    • 1.15 Creating a Clickable Part
    • 1.16 Touch Activated Explosion
    • 1.17 Dance Floor
    • 1.18 Creating a Healing Part
    • 1.19 Creating a Restricted Access Door
    • 1.20 Creating an Invisibility Part
  • Positioning
    • 2.0 Positioning Types
    • 2.1 Simple Part Positioning
    • 2.2 Overlapping Positioning
    • 2.3 Simple CFrame Positioning
    • 2.4 Rotating Toward Another Position
    • 2.5 Rotating in Radians
    • 2.6 Rotating in Degrees
    • 2.7 Relative Positioning
    • 2.8 Getting Relative Position
    • 2.9 Using the Rotational Matrix
    • 2.10 Using Lerp
    • 2.11 Simple GUI Positioning
    • 2.12 Centering GUI
  • GUI
    • 3.0 Introduction
    • 3.1 Text Label Instantiation
    • 3.2 Text Style
    • 3.3 Frame Styling
    • 3.4 Image Instantiation
    • 3.5 Creating a Button
    • 3.6 Creating a Fading GUI
    • 3.7 Text Box Input
    • 3.8 Using Adornment GUI
    • 3.9 Creating a Resize GUI
    • 3.10 Creating Custom 3D GUI
  • Beyond the Basics
    • 4.0 Using BrickColor
    • 4.1 Using Color3
    • 4.2 Using Base Classes
    • 4.3 Using Enumerations
    • 4.4 Event Members
    • 4.5 Disconnecting a Connection
    • 4.6 Using LocalScripts
    • 4.7 Creating a Regeneration Button
    • 4.8 Creating a Template
    • 4.9 Creating a Leaderboard
    • 4.10 Creating a Point Earning Button
    • 4.11 Applying the Chatted Event
    • 4.12 Applying the Changed Event
    • 4.13 Applying the ChildAdded/Removing Event
    • 4.14 Descendants
    • 4.15 Creating a Marquee
    • 4.16 Using a SpecialMesh
    • 4.17 Using a VehicleSeat
    • 4.18 Using Fire
  • Tools and HopperBins
    • 5.0 Introduction
    • 5.1 Creating a Reset
    • 5.2 Kill Tool
    • 5.3 Key Controls
    • 5.4 Creating a Sword
    • 5.5 Creating a Kick Tool
    • 5.6 StarterGear
  • Service Level (February 4, 2011)
    • 6.0 Introduction
    • 6.1 Using GetService
    • 6.2 Getting Server Time
    • 6.3 Using Lighting
    • 6.4 Awarding Badges
    • 6.5 Creator Badge
    • 6.6 Inserting Assets
    • 6.7 Retrieving IPs
    • 6.8 Setting Maximum Players
    • 6.9 Using Debris
  • Moving (February 5, 2011)
    • 7.0 Introduction
    • 7.1 Moving to a Position
    • 7.2 Moving in a Direction
    • 7.3 Rotating in a Direction
    • 7.4 Using BodyGyro
    • 7.5 Using Dampening
    • 7.6 Using Power
    • 7.7 Using BodyForce
    • 7.8 Using BodyThrust
    • 7.9 Simple Welding
    • 7.10 Weld Offset
    • 7.11 Simple Motors
    • 7.12 Motor Speed
    • 7.13 Joints
  • Miscellaneous (February 6, 2011)
    • 8.0 Local Parts
    • 8.1 Using CameraSubject
    • 8.2 Reflection Metadata
    • 8.3 Testing Chatted Event

Let's get started!