I have a good understanding of scripting. But when it comes to making a script for my game. I usually need help. I want to know what would help me KNOW what to do when I want to do something mostly. Please help me guys.
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:
function myName() print "marioblast1244" end
Now, this would only work if something activates it. Lets have it activate when a player enters the game.
function myName() print "marioblast1244" end 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.
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:
function myName() local Name = "marioblast1244" print Name end 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!