User:SoulStealer9875/How to Script/Page3: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>SoulStealer9875
Created page with "== Introduction == In this page we will learn of commentary. This allows you to make notes in your script so you know what each line of code does, or to help you continue whe..."
 
>SoulStealer9875
No edit summary
Line 28: Line 28:


[[User:SoulStealer9875/How_to_Script/Page2|<- Previous Page]] | [[User:SoulStealer9875/How_to_Script/Page4|Next Page ->]]
[[User:SoulStealer9875/How_to_Script/Page2|<- Previous Page]] | [[User:SoulStealer9875/How_to_Script/Page4|Next Page ->]]
{{User:SoulStealer9875/UnfinishedTemplate}}

Revision as of 21:07, 28 April 2012

Introduction

In this page we will learn of commentary. This allows you to make notes in your script so you know what each line of code does, or to help you continue where you left off if you take a break.

One-line notes

You can make notes on one line by using two hiphens. You know you are making a comment when the text after the two hiphens turns green. Make sure when making comments it is after a line of code, and not before, otherwise the line of code will be recognized as a comment, and not a line of code.

Example:

part = Workspace.Part -- Locates Part in Workspace
part.Transparency = 1 -- Makes Part in Workspace invisible

Multi-line notes

Instead of having to use two hiphens for just one line, you can do multi line notes. By using the two hiphens followed by two square brackets [[

Make sure that at the end of your multi-line notes you close off your two square brackets, so the compiler knows when you are done commenting and when the code begins.

Example:

--[[
These are multi line comments
after the notes I locate Part in Workspace with a variable
and set its transparency to 1, invisible.
]]
part = Workspace.Part -- Locates Part in Workspace
part.Transparency = 1 -- Makes Part in Workspace invisible


<- Previous Page | Next Page ->