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

Is there an easier way to script? [closed]

Asked by 8 years ago

I've tried everything and I can't script! Someone help me! TEACH ME!

0
ok well what do you want to know ? ProfessorSev 220 — 8y
0
"Is there an easier way to script" There are no shortcuts to scripting. We're not going to teach you, and demanding it won't help. Use YouTube, ROBLOX Wiki, and Free Models Shawnyg 4330 — 8y

Closed as Not Constructive by Shawnyg, koolkid8099, and M39a9am3R

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 8 years ago

How to start

So scripting has 6 major ideas - Declaration - Input - Output - Arithmetic (math) - Testing - Looping

Every program, game anything on a computer will use all of these aspects so its important you know about then. Once you have a basic understanding of these concepts you can script anything


Declaration

This is the idea of saving work done so far by the use of a variable. This is basically the biggest thing that sets scripting or programming apart from everything else and makes it unique.

Example :

myName = "sev"

Right there I just declared a string or group of characters like a or 1 and made the Variable myName equivalent to that string so when i reference myName the computer will give me the string "sev".

Example :

Print(myName)

Variables however can be almost anything though like an integer or long like 1 or 100000 respectively or a single or double like 3.14 or 3.1415926535 8979323846 2643383279 ... respectively however in roblox this isn't too important but something helpful to know.

Input / Output

Input and Output are how you communicate with your players or users. This can a variety of things like displaying a win or lose message to mini-maps that display the location of other players or even keyboard or mouse input. I can't think of many short examples that aren't higher level scripting off the top of my head so to prevent confusing you I will not leave an example here but if anyone can think of one leave it in the comments.

Arithmetic (Math)

This is what computers were essentially made to do, Math at a really fast pace. This will consist of what your program does essentially like calculating score for a player or what player is suited to fight what enemy or how much damage a gun does. I know most people don't like math and believe me I'm one of them but its something that you should make sure you understand at a fairly high level to make scripting easier.

Example :

pi = 22/7
twoPi = pi * 2

That example simply calculates pi which is 22/7 in case your wondering. However computers can do very complex math far beyond addition and multiplication but you probably won't use that until you start making more advanced programs and scripts so I wont talk about it.

Testing

Testing or if-statements are simple yet complex logic that allows the computer to make decisions about certain things. So in essence this is what Artificial intelligence is but only about 100,000,000 times more complex and long. But the most basic example could be something like seeing who has the higher score.

Example :

player1Score = 10
player2Score = 20

if player1Score > player2Score then
    print("Player 1 Wins.")
else
    print("Player 2 Wins.")
end 

That example will obviously print "player 2 wins" because that is the higher score. This is important because player 2 won't always win so making the computer decide makes our games and programs more friendly and fun to the players and users this way.

Looping

This is the idea that we can make the computer do something 10 times or 20 times or until someone wins but in essence just do the same thing more than once. So some examples are add to score while living is true or maybe or give a player 10 points over the course of 10 seconds.

Example :

score = 0

for i = 0, 10
    score = i
    print(score)
    wait(1)
end 

That will increase a players score by 1 every second 10 times. This will become very useful when you need to do something to every player or something several times. However using a loop might not always be prevalent right away so when you program always ask yourself if you are repeating something and if so you can probably use a loop instead.

So to wrap this up I covered the most basic ideas of scripting which is enough to do some simple stuff but to really utilize everything you can do I would visit the roblox wiki page and look through some of those tutorials because there are probably about 7 different ways to solve a problem with scripting but about 6 of those ways are 3 times longer than the seventh.

Ad