Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 7 years ago

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 3615 — 7y
0
I'm sorry but, it's true! Is there any way to make me know WHAT to do? Daiko_King 1 — 7y
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 18071 — 7y
0
k Daiko_King 1 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago

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!

Ad
Log in to vote
-1
Answered by 7 years ago

Roblox wiki

http://wiki.roblox.com/index.php?title=AllTutorials

Answer this question