Skip to content

Quick Notes

RigidStudios edited this page May 23, 2020 · 2 revisions

Notes

Datatypes

--Variable = Piece of information 
    myVar = game.workspace.part --Variable name can be almost anything except built in functions, and can't start with a number
    local myVar = game.workspace.part --Variables can also be declared as local if they don't need usage in multiple scripts.

--Bolean value = only a true or false value. 
    game.workspace.Part.Anchored = false

--Printing = says something in Output, a.k.a. Console. Useful for Debugging.
    print("Hello world!")
    print(myVar) --Can also print values inside variables!
    print(myVar + 1) --Supports Mathematical Operations

--Output = A place to check for bugs, used to see printing commands or mistakes.
--To access: View > Output

-- String = A piece of information whithheld in quotes ("") or in single quotes ('')
    local myText = "Hello" or 'Hello'

-- Float = A number value, a number, surrounding it with quotes will render it as a string
    local myNumber = 16.666 or 20

-- Vector3 = Used to edit values that uses 3 values.
    game.workspace.Part.Position = Vector3.new(10,13,40)
--                                             x  y  z

-- CFrame = A Position and an Orientation in one.
    local cframe = CFrame.new(0,5,0) --[[This is the Positional Component, acts like Vector3, X Y Z]] * CFrame.Angles(math.rad(45),0,0) --[[This is the Rotational Component, the rotations are in Radians, so math.rad() will get you the radian from the degrees. X Y Z]]

-- Color3 = A Color.
    local color = Color3.fromRGB(255,255,255) -- White (fromRGB takes values 0-255)
    local color2 = Color3.new(0,0,0) -- Black (new takes values 0-1)

-- BrickColor = A more forgiving color type.
    local color = BrickColor.new(Color3.new(0,0,0)) -- Color3 Black
    local color2 = BrickColor.new(0,0,0) -- RGB Black
    local color3 = BrickColor.new("Pastel Green") -- Color Name Pastel Green

-- Enum = A list of Properties and of Values that can't be defined or are hard to define through a string.
    game.workspace.Part.Material = Enum.Material.Neon 

Clone this wiki locally