Roblox > Scripting Lessons >

Lesson 2: Using Built-In Variables

Now I will teach you how to use built-in variables to change properties of objects in the game.

Notice how when you are playing in solo mode and you show the tools, you can see two windows on the right side of the screen. These windows are the explorer window, and the properties window. You will also notice how when you select a brick in-game, the properties window shows a bunch of different values. Most of these values can be modified by changeing their values in the properties window. You can use scripts to change the values of built-in variables.

For example, place this script in a brick and you will see that it changes 50% transparent 10 seconds after the game starts:

wait(10) -- Wait 10 seconds
script.Parent.Transparency = 0.5 -- Modify the built-in variable "Transparency" to make the brick turn 50% transparent.

Again, if you have any questions about this lesson, PM me or Post on the Forums.

- Ajedi32

<- Previous Lesson  Next Lesson ->

Updated on Apr 23, 2010 by Ajedi32 (Version 10)
comments powered by Disqus