Category:Scripting Tutorials: Difference between revisions

From Goodblox Wiki
Jump to navigationJump to search
(Created page with "Scripting tutorials are tutorials teaching how to do something involving Lua code.")
 
No edit summary
Line 1: Line 1:
Scripting tutorials are tutorials teaching how to do something involving Lua code.
Scripting tutorials are tutorials teaching how to do something involving Lua code.
{{CatUp|Tutorials}}
== Introduction ==
This article will explain different ways of adding [[GBX.lua.Message (Object)|messages]] and [[GBX.lua.Hint (Object)|hints]] to your place.
== How to Insert a Message ==
While in [[GoodBlox Studio]],
:1. In the [[Explorer]] panel, select [[GBX.lua.Workspace (Service)|Workspace]]
:2. Go to '''Insert''', then '''Object...'''
::{{Studio|Menu$Insert}}
::{{Studio|Menu$Insert$Object}}
:3. In the window that pops up, find '''Message''', and click '''OK'''
:4. In the Explorer panel, select the message you inserted
:5. In the [[Properties]] panel, find [[Text (Property)|Text]]
:6. Type the text you want the message to say, and press enter
Your message should appear on the screen.
== How to Insert a Hint ==
While in GoodBlox Studio,
#In the Explorer panel, select Workspace
#Go to Insert, then Object...
#In the window that pops up, find '''Hint''', and click OK
#In the Explorer panel, select the hint you inserted
#In the Properties panel, find Text
#Type the text you want the hint to say, and press enter.
Your message should appear at the bottom of the screen.
== Scripting and Messages ==
You can use [[scripting|Scripting]] to have more control over your messages.
While in GoodBlox Studio,
#In the Explorer panel, select Workspace
#Go to Insert, then Object...
#In the window that pops up, find '''Script''', and click OK
#Find the script in the Explorer panel, and double-click it to open the script editor.
#Copy the following and paste it into the script:
<pre>
local m = Instance.new("Message") -- inserts a new message
m.Parent = game.Workspace -- put the message in the workspace
m.Text = "Hello World!" -- change "Hello World!" to whatever you like
wait(10) -- waits 10 seconds
m:Remove() -- removes the message
</pre>
Once you have done that, click the '''Close Tab''' [[Image: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!'''
=== Hints ===
Here is the same script as above, but for hints:
<pre>
local h = Instance.new("Hint")
h.Parent = game.Workspace
h.Text = "Hello World!"
wait(10)
h:Remove()
</pre>
== See Also ==
*[[Hint]]
*[[Message]]
*[[Nil]]
[[Category:Scripting Tutorials]]

Revision as of 17:23, 22 June 2020

Scripting tutorials are tutorials teaching how to do something involving Lua code.


Introduction

This article will explain different ways of adding messages and hints to your place.

How to Insert a Message

While in GoodBlox Studio,

1. In the Explorer panel, select Workspace
2. Go to Insert, then Object...
Template:Studio
Template:Studio
3. In the window that pops up, find Message, and click OK
4. In the Explorer panel, select the message you inserted
5. In the Properties panel, find Text
6. Type the text you want the message to say, and press enter

Your message should appear on the screen.

How to Insert a Hint

While in GoodBlox Studio,

  1. In the Explorer panel, select Workspace
  2. Go to Insert, then Object...
  3. In the window that pops up, find Hint, and click OK
  4. In the Explorer panel, select the hint you inserted
  5. In the Properties panel, find Text
  6. Type the text you want the hint to say, and press enter.

Your message should appear at the bottom of the screen.

Scripting and Messages

You can use Scripting to have more control over your messages.

While in GoodBlox Studio,

  1. In the Explorer panel, select Workspace
  2. Go to Insert, then Object...
  3. In the window that pops up, find Script, and click OK
  4. Find the script in the Explorer panel, and double-click it to open the script editor.
  5. Copy the following and paste it into the script:
local m = Instance.new("Message")	-- inserts a new message
m.Parent = game.Workspace		-- put the message in the workspace
m.Text = "Hello World!" 		-- change "Hello World!" to whatever you like
wait(10)				-- waits 10 seconds
m:Remove() 				-- removes the message

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 Template:Studio button. Be sure to save your place first!

Hints

Here is the same script as above, but for hints:

local h = Instance.new("Hint")
h.Parent = game.Workspace
h.Text = "Hello World!"
wait(10)
h:Remove()

See Also

Pages in category "Scripting Tutorials"

The following 66 pages are in this category, out of 66 total.