Ad
Log in to vote
-2

How do you make a script make a message wait a couple secs then remove it?

Asked by 7 years ago
--insert message code here
wait(5)
game.Workspace.Message:Remove()

6 answers

Log in to vote
0
Answered by
Vividex 162
6 years ago

Messages are Simple GUI's that appear on your full screen! Of course you can edit things like UDim2, Transparency, color, Velocity but a simple Message can be created by creating a new Instance like this!

Instance.new

Now we want the new item that is going to be inserted a message, so we would do...

Instance.new("Message")

But now the Message has no were to appear! The best place to make the message appear is in the workspace so everyone can see! So we would do

Instance.new("Message", Workspace)

Oh look! We want to wait a couple of seconds then delete it! But how are we supposed to delete a random upcoming message! Well, we would use a variable! A variable is just a shorter way of saying something else, for example lets say I wanted to say Workspace in the computer, but I didn't want to type it all, so I would use a Variable which is a word like W, so like

local W = Workspace

But we want it for the message, so lets do..

local m = Instance.new("Message", Workspace)

Now the Instance will be recognized as the letter m But, instead of doing ("Message", Workspace) We can do:

local m = Instance.new("Message")
m.Parent = Workspace --Does the same thing but adds another line

But we want it as short as possible so we will stick with the other one. Now, we want words to appear, so we would use Text! SO...

local m = Instance.new("Message", Workspace)
m.Text = "Put text here!" --Add your text!

Which tells the computer that you want that to appear on your screen! Now we want it to stay on the screen for a couple of seconds! So we would have to use a wait() which tells the command to wait a certain amount of seconds, so..

local m = Instance.new("Message", Workspace)
m.Text = "Put text here!" --Add your text!
wait(5) --You can change five to whatever number, but for now, it will wait 5 seconds

Now we have to remove it! The best way would be to use :Destroy() which permanently removes an item of "Instance" So..

local m = Instance.new("Message", Workspace)
m.Text = "Put text here!" --Add your text!
wait(5)
m:Destroy() --See how I used the variable instead of typing game.Workspace.Message:Destroy()?

Hope this helped, enjoy scripting!

Ad
Log in to vote
1
Answered by
Unclear 1776 Moderation Voter
7 years ago
m = Instance.new("Message", workspace) -- Creates the message. Variable m now references the message. 
game.Debris:AddItem(m, 5) -- Adds the message to the Debris queue. The message will be automatically removed in 5 seconds. 
0
But how do I pick what it says? cristinon 0 — 7y
Log in to vote
1
Answered by 1 year ago
beans
Log in to vote
0
Answered by
Bubby4j 231 Moderation Voter
7 years ago

Just insert a message object!

local msg = Instance.new("Message")
msg.Text = "Message here!"
msg.Parent = game.Workspace
wait(10)
msg:Destroy()

Another, more complicated, modern, way to do it is to make a GUI that appears, and style it however you'd like. The Message object was made when GUIs didn't exist.

0
Yea I tryed guis but it didnt work well THX -cris cristinon 0 — 7y
Log in to vote
0
Answered by 7 years ago
Msg = Instance.new("Message", Workspace)
Msg.Text = "Your Text Here" --Your text here
wait(3)
Msg:Remove()
Log in to vote
0
Answered by 6 years ago

First, we want to insert a Message so we do:

m = Instance.new("Message") -- the m is the message's name.

then we want it to appear somewhere don't we? so copy this line and paste it in the script.

m.Parent = game.Workspace

now for the 3rd step, we add text to it!

m.Text = "Put Text Here" -- change the text to whatever you like and paste this part below the ----------2nd    step.

And finally, we want it to disappear! so we do this:

wait(5)
m:Remove()        -- :Destroy() will also work.

if you wanted to, you could also make a little animation. here's an example:

m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "waiting."
wait(5)
m.Text = "waiting.."
wait(5)
m.Text = "waiting..."
wait(6)
m:Remove()

ok, this is it! you just learned how to create messages and edit their Text!

Answer this question