Output

From Legacy Roblox Wiki
Jump to navigationJump to search

The Output is a panel in Roblox Studio, that displays printed strings or error messages. The print and error functions are mainly used to send messages to the output.

What the Output can be used for

The output can be used for different things. One of the main ways to use the output is to debug code. When testing a really big script, you may want to throw a few print commands to the output. You can even use it to throw an error using the error function. Other times, beginning scripters will use the output to learn how to script. When you create a new script object in Roblox Studio, the code that it has is:

print("Hello world!")

When you press the green play button at the top of the screen with the output panel open, without changing the script, you will see that it says Hello world!.

How to use the Output

When first learning how to script, you will want to have the output open. To do this, perform the following steps:
Go to

  • View
    • Output

and click it.

Now, you will see the Output at the bottom of your screen. If you want to see it in use, try out the following code in a script:

loops = 5
for myVar = 1, loops do
    print("This is a test print to the output.", myVar .. " time(s) so far")
end

After running that code in Studio, you should have this in your output:

This is a test print to the output. 1 time(s) so far
This is a test print to the output. 2 time(s) so far
This is a test print to the output. 3 time(s) so far
This is a test print to the output. 4 time(s) so far
This is a test print to the output. 5 time(s) so far

Using the output isn't really that hard. Once you learn the print function, you can use the output.

You can also use the output to induce your own errors. Use this code to induce your own error:

errMsg = "This is my own error!"
error(errMsg, 0)

Your output should have red text in it, that says This is my own error!.
The output is a useful tool.