User:ThePeace/ThePeace Scripting Guide

From Legacy Roblox Wiki
Jump to navigationJump to search

Well, my other page was changed by someone, so I'm REMAKING it.


Scripting

I made this page to teach about while true do and end, and maybe some more techniques of scripting. We'll start out with a simple script.


while true do h = Instance.new ("Hint") h.Text = "Hello, in many languages." wait(2) h.Text = "Bonjour" wait(2) h.Text = "Ohio" wait(2) h.Text = "Konichiwa" wait(2) h.Text = "Hola" wait(2) h.Text = "Ciao" wait(2) h.Text = "Allo" wait(2) h.Text = "Hallo" wait(2) h.Text = "And finally........" wait(2) h.Text = "Hello." wait(2) end

That script is moderately easy. If you want to test it, go to a script builder or your own place and insert this script.

Breakdown

While true do starts the loop and end....well ends the loop. Simple, right? WRONG! The next test will prove that. Look back at the script and find the last wait() function. Remove the last wait() and put the script in again. After you do that check the next column to see if you did it right. DON'T LOOK AHEAD IF YOU HAVEN'T DONE THE SCRIPT YET.



The Results

If you did it the way I said for you to do it, you probably got a crash because the loop kept going BEFORE the last one was finished.

Updates:

Soon.

Links

In-Depth Scripting Guide