[go: up one dir, main page]

0% found this document useful (0 votes)
30 views2 pages

Intro To Coding Handout

This document provides an introduction to coding concepts for Roblox including how to create scripts, print functions, variables, properties, loops, and troubleshooting. Key concepts covered include creating new scripts, printing text, using strings and numerical variables, dot notation for properties, wait functions, local variables, and script parents.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Intro To Coding Handout

This document provides an introduction to coding concepts for Roblox including how to create scripts, print functions, variables, properties, loops, and troubleshooting. Key concepts covered include creating new scripts, printing text, using strings and numerical variables, dot notation for properties, wait functions, local variables, and script parents.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Intro to Coding Cheatsheet

Create New Scripts Run Code


Right-click object > Insert New Script Press Play.

Print Function Comments


Displays text on the screen. Green notes saying what the code does.
● Example: ● Example:
print​​(​"Hello world!"​) --Turns PracticePart green

Variables
Placeholders for information the program will use later. Variables can be changed and worked
with in a variety of ways.

String Variables Numerical Variables


Holds groups of letters and/or numbers. Uses Used to count things Does not have quotation
quotation marks. marks.
Example: ​“This is a string” Example: ​5
In use: ​print​​(​"5 is my favorite"​) In use: ​wait​​(​3​)

Properties
Any characteristic of an object.
Examples include color, visibility, speed, and health points.

Dot notation
Used to separate names of objects, properties, and keywords like “new”.
Example: ​game​​.Workspace.PartName.BrickColor =
BrickColor.new(​0.9​,​0.8​,​0.1​)

Wait Function
Makes the program wait a number of seconds before going to the next line of code.
Example: ​wait​​(​4​)

These documents are licensed by Roblox Corporation under a ​Creative Commons


Attribution-NonCommercial-ShareAlike 4.0 International License​. ​Roblox, Powering Imagination, and
Robux are trademarks of Roblox Corporation, registered in the United States and other countries
Intro to Coding Cheatsheet
While true do
Loops the code between ​while true do​and ​end​ over and over
Example:
while true do
wait​​(​3​)
Part.BrickColor = ​BrickColor​​.​new​(​0.9​,​0.8​,​0.1​)
wait​​(​3​)
Part.BrickColor = B​ rickColor​​.​new​(​0.9​,​0.4​,​0.9​)
end

local Variables
Use the keyword local and a name to create your own variable. No spaces in the name.
Example: ​local ​NameOfMyVariable = script.parent

Parents and Children


The relationship between two objects. In this
image the parent is the part. The child is the
script.

script.Parent
Directs a script to its parent. Usually a part.
Example: ​local ​NameOfMyVariable = script.parent

Troubleshooting Steps
1. Look for red lines in the code and follow instructions
2. Check that capitalization matches exactly
3. Check for missing quotation marks or parentheses
4. Make sure there are no spaces in variable names
5. Make sure that necessary code isn’t commented out (green)
6. Have a few friends look at your code. Everyone needs fresh sets of eyes sometimes.

These documents are licensed by Roblox Corporation under a C ​ reative Commons


Attribution-NonCommercial-ShareAlike 4.0 International License​. ​Roblox, Powering Imagination, and
Robux are trademarks of Roblox Corporation, registered in the United States and other countries

You might also like