NOTICE
This isn’t 100% correct and i don’t know how to explain so many things. Some stuff that i note is basically taken of google or it’s utilizing on my knowledge. I’m just trying to help you! (this is a past notice)
Introduction to Luau
Luau is a fast, small, safe, gradually typed embeddable scripting language derived from Lua. It is designed to be backwards compatible with Lua 5.1, as well as incorporating some features from future Lua releases, but also expands the feature set (most notably with type annotations).
Luau is made for roblox with lots of modifications with the scripting language Lua.
Hello World!
To start with simple stuff about scripting, You will require a script.
If you create a script and double-click it you will see the following line:
print("Hello World!")
This line will send a message to the output and the server (since it’s a serverscript).
It’s really useful on debugging your code to check if it’s working or not.
There are other types of prints such as
warn("Hello World!")
error("Hello World!")
Warn will print a yellow message to the server to serve as a warning.
Error will do the same thing as Warn and print (but with a red color) but you cannot add any more line after that. (except for ends)
You can write code after a error if inbetween there is a end (in this case a function which is gonna be later explained in the next post.)
Variables
Variables are stuff to store values such as the location of a part.
Here’s a example of a variable:
local variable = 3
You can use it in so much stuff to determine a value, And yes, It’s editable in the script by a line.
local variable = 3
variable = 2 --Changes the variable to 2 instead of keeping it as 3.
Variables + Prints
You can print a variable as soon it is classified as a string.
local variable = "Hello!" --in this case it will be a string type (note that numbers are still classified as a printable way)
print(variable)
You can change the name of the variable by editing it. Not just being “variable”
local Message
local ItsAVariable
local HiDevforum
--Variables without a value is classified as nil.
Prologue
I hope this helps on scripting, If you want more, Tell me in the replies. You can rate it if you want, It’s really simple!