Fandom

ROBLOX Wikia

Print

12,753pages on
this wiki
Add New Page
Comments0 Share

Introduction

Print is one of the basic functions of ROBLOX scripting; it is a very simple method with a single parameter . The method shows in the ROBLOX Studio's output box whatever string is entered in the parameters, or if there is a polynomial within the parameters , whatever the polynomial equals. For example,

 print("Hello world!")

Would show in the output:

Hello world!

Strings vs. Polynomials

If you want to output exactly what is typed within your parameter, you enter the text within double quotes within the parentheses, however if you are trying to make RBLX.lua calculate a polynomial, then do not use double quotes, and simply enter your polynomial in the parentheses. As an example:

print("1+1") 
--Double quotes cause the entered text to be outputted as-is

Would output:

1+1

But

print(1+1)
--No quotes tells the engine that there is a calculation to be performed

Would output:

2

Use of Variables

Variables can also be inputted into the parameters, for example:

a = "Hello World!"

print(a)



Would output:

Hello World!

Note that the quotes rule still applies as before, so

a = 1+1

print(a)

Would output:

2

In addition...

a = 1

print(5+a)

Would output:

6

Usage

As the print command does not actually interact with the ROBLOX Workspace, scripters mainly use this command for debugging to check if and when a certain action in their script has been performed, and, if one of the actions failed, which action in the script failed.





















Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.