User:SoulStealer9875/How to Script/Page2

From Legacy Roblox Wiki
Revision as of 14:45, 29 April 2012 by >SoulStealer9875
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Introduction

This page is dedicated to properties, if you already know about properties and how to access them via script, you can always skip this.

What are properties?

Properties are found in all objects. To view a certain object's properties in Properties pane, open up the pane (view -> properties), insert the object you want to know about it's properties and take a look at its properties in the properties pane.

Properties are used to customize the object. Some examples are BrickColor, to change its color, Transparency, to change transparency to invisible, translucent or opaque, CanCollide to see if you can collide with it or walk through it, there are lots of different properties for different objects.

Number Properties

Some properties, such as Transparency, are number properties. You can tell this because their default value is a number. Here are some examples:

Transparency 0 = Opaque 0.2/0.3 = Translucent 0.5 = Transparent 1 = Invisible
Reflectance 0 = Not shiny 0.5 = Semi-shiny 1 = Very shiny

You get the idea. Changing them with a script is the same thing. First, locate the object. You can use a variable if you are going to change it frequently with a script, or you can do it direct.

Direct:

Workspace.Part.Transparency = 0.5

Variable

part = Workspace.Part
 part.Transparency = 0.5

Does exactly the same thing, two different methods of doing this.

Color3 Properties

Some properties, such as BrickColor property of Part, WedgePart etc. is a Color3 property. We will learn of Color3 properties later, as they are a little more advanced.

Bool Properties

You get some properties such as CanCollide that are a Boolean. They are either true or false, in this case, true being collidable and false being walkthrough and is completely the same in a script.

Workspace.Part.CanCollide = false

Enum Properties

Read up on your Enum Properties here


<- Previous Page | Next Page ->