Roblox > Scripting Lessons >

Lesson 3: Comments

This has got to be one of the simplest lessons yet. You may already know how this works.

Placeing two hypens (--) comments off the rest of the line of code.

For example, place this script in a brick and watch what happens.

-- wait(10)
-- script.Parent.Transparency = 0.5

This is the same script from the previous lesson commented out. You will find that it does absolutely nothing. Now remove the double hyphens at the beginning of each line and watch what happens. This can be used to explain or comment on lines of code. You can also make multi-line comments by placing two ['s immediately after the two hypens and then ending the comment with two ]'s. For example:

--[[
wait(10)
script.Parent.Transparency = 0.5
]]

Let me know if you have any questions.

<- Previous Lesson  Next Lesson ->


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