Still have questions? Join our Discord server and get real time help.
1

# How exactly do you guys know what functions,variables,etc to put?

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.

0
Give an explaination of what you want to know, saying "i want to learn to script this when:" is too global. RubenKan 3593 — 3y
0
I'm sorry but, it's true! Is there any way to make me know WHAT to do? Daiko_King 1 — 3y
0
This is a very interesting question, but is probably too broad for a Question on SH. I will make a note of it and see if I can write a tutorial/blog post BlueTaslem 17977 — 3y
0
k Daiko_King 1 — 3y

1

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



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