Roblox scripting -- how to program a message for your workspace
This user comes from kidslike.info
Find other posts in the same category: | |

Why I wrote this article

Congratulations to our junior programmer (JP)! JP is ten-years-old. Today is Dec. 9, 2008. JP just wrote his first Lua script today. He did this completely by himself without any adult help in about 15 minutes. JP followed instructions from
http://wiki.roblox.com/index.php/How_to_add_messages
We have re-written the instructions to make them easier to understand.


Main Article

Steps

1. Open Roblox Studio
2. If you don't have a section on the right that's called the Explorer Window, go to View> Explorer.
3. In the Explorder window, click on Workspace.
4. On the menu bar at the top of the screen, go to Insert> Object.
5. Double-click Script to insert a script.
6. Double-click the word script that appeared in the Explorer window.
7. On the left side is now a big pane where you can put your script. Copy and paste this script into the pane:

local m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "I am awesome!"
wait(10)
m:Remove()

8. If you are typing it in, make sure everything is exact, including capitalization.
9. Close the script editor by clicking on the x in the upper right corner of the script pane
10. Exit your place by clicking Exit
11. Choose Save
12. Play your game. You will now see your message in the middle of the page.
Congratulations.

WHAT EACH LINE MEANS

1. THE FIRST LINE
local m = Instance.new("Message")
This means make a new message and give it the name "m". Think of m as a nickname, that is short for message. A new instance means to create a new one.

2. THE SECOND LINE
m.Parent = game.Workspace
This means -- Where should the message go? It goes into the Workspace

3. THE THIRD LINE
m.Text = "I am awesome!"
What are the words (text) of the message? It is whatever is between " and " -- I am awesome. You can change this message to be whatever you want. Try changing it to "KidsLike.info is great!"

4. THE FOURTH LINE
wait(10)
This means wait for 10 seconds and then remove the message. You can change the 10 to whatever you want. Try changing it to 30.

5. THE FIFTH LINE
m:Remove()
Can you figure out what this line does? It removes the message.

Congratulations! You've just finished your first Roblox scripting tutorial.


Previous encyclopedia page

This is an encyclopedia article on Kids Like . info. We try to write in a style that is easy enough for children to understand, but still provides useful and important information. You can help us improve these articles by adding a comment with suggestions. If you have a suggestion about an article you would like to see, you can write it yourself or use the Contact Us tab under the logo. You can log in as "guest" with the password "guest"