How to add messages: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
no edit summary
>Jaccob
(I believe this would be a little too advanced, for users learning wiki.)
>JulienDethurens
No edit summary
Line 3: Line 3:
== Introduction ==
== Introduction ==


This article will explain different ways of adding [[RBX.lua.Message (Object)|messages]] and [[RBX.lua.Hint (Object)|hints]] to your place. You'll find you can apply your new knowledge of Insert->Object to other things, and see '''''loads''''' of objects you can insert
This article will explain different ways of adding [[RBX.lua.Message (Object)|messages]] and [[RBX.lua.Hint (Object)|hints]] to your place. You'll find you can apply your new knowledge of <kbd>Insert</kbd>-><kbd>Object</kbd> to other things, and see '''''loads''''' of objects you can insert.


== How to Insert a Message ==
== How to insert a message ==


While in [[Roblox Studio]],
While in [[Roblox Studio]],
Line 17: Line 17:
Your message should appear on the screen.
Your message should appear on the screen.


== How to Insert a Hint ==
== How to insert a hint ==


While in Roblox Studio,
While in Roblox Studio,
Line 29: Line 29:
Your message should appear at the bottom of the screen.
Your message should appear at the bottom of the screen.


== Creating 'Message' Objects ==
== Creating Message objects ==


You can use [[scripting|Scripting]] to have more control over your messages.
You can use [[scripting]] to have more control over your messages.


While in Roblox Studio,
While in Roblox Studio,
Line 40: Line 40:
#Copy the following and paste it into the script:
#Copy the following and paste it into the script:


<code lua>
{{code|=
local message = Instance.new('Message', Workspace) -- Insert a new message in the Workspace.
local message = Instance.new('Message', Workspace) -- Insert a new message in the Workspace.
message.Text = "Hello World!" -- Set the text of the message to "Hello World!".
message.Text = "Hello World!" -- Set the text of the message to "Hello World!".
wait(10) message:Destroy() -- Remove the message after 10 seconds.
wait(10) message:Destroy() -- Remove the message after 10 seconds.
</code>
}}


Once you have done that, click the '''Close Tab''' [[Image:P01F15.png]] button to exit the script editor.
Once you have done that, click the '''Close Tab''' [[File:P01F15.png]] button to exit the script editor.


To run the script, press the '''Play''' {{Studio|Test$Run}} button. '''Be sure to save your place first!'''
To run the script, press the '''Play''' {{Studio|Test$Run}} button. '''Be sure to save your place first!'''


== Creating 'Hint' Objects ==
== Creating Hint objects ==


Here is the same script as above, but for creating [[Hint|hints]]:
Here is the same script as above, but for creating [[Hint|hints]]:


<code lua>
{{code|=
local hint = Instance.new('Hint', Workspace) -- Insert a new hint in the Workspace.
local hint = Instance.new('Hint', Workspace) -- Insert a new hint in the Workspace.
hint.Text = "Hello World!" -- Set the text of the hint to "Hello World!".
hint.Text = "Hello World!" -- Set the text of the hint to "Hello World!".
wait(10) hint:Destroy() -- Remove the hint after 10 seconds.
wait(10) hint:Destroy() -- Remove the hint after 10 seconds.
</code>
}}


== See Also ==
== See also ==


*[[Hint]]
*[[Hint]]
Anonymous user

Navigation menu