User:SoulStealer9875/How to Script/Page3
Introduction
In this page we will learn of commentary. This allows you to make comments 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 comments
You can make comments 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 comments
Instead of having to use two hiphens for just one line, you can do multi line comments. By using the two hiphens followed by two square brackets [[
Make sure that at the end of your multi-line comments 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 comments 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