LESSON 2 :- Printing
Alright, let's get started with lesson 2, printing. Now this is VERY easy if you concentrate a bit, so I assume if you're reading this you already have roblox studio, which if you don't know is a place where you code and make games for roblox. So, let's get started, what is printing? Well printing is a function type thing, where we can use it as a well "troubleshooter" or anything so, go create a new "script" in ServerScriptService in roblox studio, and type in the code
print("This is a print")
After running the code, you will see that it brought up the message "this is a print", this sends a message to your output, which you can enable through the roblox studio its this thing where it shows your errors and stuff in your game. But in this case since you printed something it will show the message in the output, in this case it will show ("This is a print"), alright now a lot of you guys might be thinking, whats the use of this then? Well as said above we use this as a "troubleshooter" where when we have a BUNCH of code and it isn't working, we put these print statements in between the code and when the print stops or it doesn't print anything we can check where it stopped and from that we could fix up the bugs in our script, we could also use printing in a way like this
print(2 + 2), print(5 + 5), print(10 + 10)
Here are you can see we are trying to print these basic math problems, and when you try this it will automatically print the answer to these questions! And you can pair these with variables (which I assume you know)
local x = 16
local y = 2
print(x + y)
This will print these 2 values added with another, and well 16 + 2 = 18 so it will print 18, now this works with subtraction, multiplication and division
print(x - y), print(x * y), print(x/y)
You can also use print to figure out what something is, like for example if we print a part like this
local part = Instance.new("part", workspace)
print(part)
Now since "part" is a variable and its holding a part inside of its value, then if you print it, it will tell you what it is, so for example if its a part like here it will print "Part" if the part is a meshpart like this
local part = Instance.new("MeshPart", workspace)
print(part)
Then it would print "MeshPart" now this is important in ALOT of ways from troubleshooting, and a lot more.
Alright so now thats it for the lesson if you have a bit more questions then do please ask me in discord! Ik this was a bit fast paced but you will need to concentrate to know/learn more