Functions and Events

*此內容很快就會推出您所選的語言版本。

Series Description

Use functions and events to make code run when you want, as often as you want. With functions and events you can set up traps, buttons, health pickups, and more.

Covered in this course are functions, parameters, arguments, and returning values.

Objectives and Prerequisites

Learning Objectives

Learn to place code into reusable chunks called functions.

Understand what it means for code to be "in scope".

Set up events within an experience and use them to tell the functions when to run.

Practice using functions and events to create traps and buttons.

Prerequisites

Basic knowledge of Roblox Studio such as moving and rotating parts. Previous experience creating Script objects and using variables, properties, and strings.

Series Contents

ArticleDescription
Coding a FunctionSet up chunks of code in a way that only runs when you tell it to run.
Using Parameters and EventsHow to code a function when you don't have all of the information yet.
Parameters Practice - ButtonsPractice using events and parameters by making a bridge appear in-world with the push of a button.
Multiple Parameters and ArgumentsPass multiple pieces of information into a function at once.