Well, to put it into perspective, functions and variables aren't that hard once you learn about them. Functions are things that happens when something else activates is. An example is that when you want to print my IGN when I want it to, you would put something like this:
Now, this would only work if something activates it. Lets have it activate when a player enters the game.
5 | game.Player.PlayerAdded:connect(myName) |
This will print in the Output Bar so if you want that to be shown then go to "View" and click on "Output Bar." If it prints marioblast1244, then the code works!
Variables are easy compared to functions. Variables are things that hold a value. There are many different types of values, like numbers or "True" and "False." For instance, I could put my name into a variable.
1 | local Name = "marioblast1244" |
This will keep this in there until you set the variable "Name" to a different value or nil
. So if you want to use a variable to print my name when a player joins, then this is what it should look like:
2 | local Name = "marioblast1244" |
6 | game.Player.PlayerAdded:connect(myName) |
That's all of the basics! Hope this helped you! And if it did, then please hit the "Accept Answer" button!