Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Here we are, Anyways, Welcome to the beginning of the scripting basics guide thingy
- Anyways, lets start
- ---------------
- Roblox Studio uses the coding language: Roblox Lua
- It is the roblox language used by all games and its a modified version of lua
- But anyways, here is the general stuff and dictionary you want to know first before
- diving into any kind of coding:
- =====| Math Sign |=====
- Very important btw
- + = Addition
- - = Subtraction
- * = Multiplication
- / = Division
- % = Modulus (added this since this is not percentage as you may think)
- =====| Variables |=====
- Variables are the very core of scripting, They hold a value and thats what they do
- This is a variable, and below here, you can see that the variable named "Example", stores the value
- "nil", nil doesnt mean anything, its basically what is the value given if it doesnt exist or is nothing
- ]]
- Example = nil
- --[[
- Variables can store many more variables, including themselves
- Think of variables like a small box you can put things in
- Here is a small list of stuff
- a variable can store
- ]]
- Integer = 1
- --This is an integer variable, it holds a number
- Float = 4.2145
- --Floats are the same as the one above, except the numbers have multiple decimals
- --Integers turn into Floats when you add a decimal to them
- String = "text"
- --Strings are variables that hold text
- Boolean = true
- --Booleans are variables that hold true or false values
- vector3 = Vector3.new(1,1,1)
- --Vectore3 values are values that hold a Vector3, They are commonly used for xyz Positions
- color3 = Color3.fromRGB(0,0,255)
- --Color3 values are just variables that hold a Color3 in RGB format
- Table = {1,2,3}
- --Table values hold a table of values, a bit complicated and you shouldnt worry about
- --trying to understand what this does until much later
- --[[
- Here are examples of variables being used
- ]]
- Coins = 5000
- DamageMultiplier = 1.45
- DialougeText = "Hello!"
- --[[
- Along with Variables, you can also use something called print()
- ]]
- print()
- --[[
- Print basically prints a value to Outpute (which can be viewed in VIEW >> Output: https://gyazo.com/3c2ad715475c7aceff188a4e861a47ff)
- Print can display any variable and combinations of them, The ">" displayed under a print says what
- will be printed to Output
- ]]
- print("Here is some text")
- -->Here is some text
- print(24 + 20)
- -->44
- print("First Line")
- print("Second Line")
- -->First Line
- -->Second Line
- --Here is something interesting about prints: You can print variables directly
- --Here is an example
- textToPrint = "Hello!"
- print(textToPrint)
- -->Hello!
- --[[
- now lets get into something slightly more complex
- For variables, Variables can also store other variables, And Variables can be added or 'fused' together
- Example:
- ]]
- integer1 = 51
- integer2 = 23
- print(integer1 + integer2)
- -->74
- int1 = 50
- int2 = 40
- int3 = int1 + int2 --This sets the value of int3 as the additive of int1 and int2
- print(int3)
- -->90
- --[[
- And finally, about Variables, They can be edited and overwritten
- Just like a box of items, You can put more stuff in, or take everything out of the box and
- put something new in
- (except that box can only have one type of thing)
- Examples:
- ]]
- integer = 50
- integer = integer + 12 --This is the exact same as 50 + 12, as "integer" has the value 50
- --^^^note that you can shorten this with +=,-=,*=,/=, These are the same thing
- --example:
- value1 = 124
- value1 += 50 --Takes value1 and adds 50, then sets value1's value as the new value
- --Back to original topic
- variable = 125
- variable = 275
- --This sets the value of "variable" to 275, you can also overwrite it with an entirely new type of value
- something = 524
- something = "newValue"
- --This turns "something" into a string value, a new variable isnt created, just overwritten
- --Using the variable named "something" just uses the new value instead
- --[[
- This should be the basics of variables i think
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement