I always wondered if you can make a message with a script. Example: I wanted to say Hello World! then wait 5 seconds.
COMMUNITY QUESTION
How do I make a message with a script?
2 answers
z = Instance.new('Message', workspace)
z.Text = "Your message"
wait(5)
z:Destroy()
;]
There are lots of ways to do this. If you want to make a message for everyone, you could do this:
local Message = Instance.new("Message",Game.Workspace)
Message.Text = "Hello World"
wait(5)
Message:remove()
OR if you want it to be like a PM(Personal Message) for only 1 person you could do this:
local Message = Instance.new("Message",Game.Players["PLAYERNAME"].PlayerGui)
Message.Text = "Hello World"
wait(5)
Message:remove()
then only that person would get it. You could even turn it into a function so you can do it multiple times without having to re-write everything like this:
function Message(Text, Time, P)
local New = Instance.new("Message",P)
New.Text = Text
wait(Time)
New:remove()
end
Message("Hello World", 5, game.Workspace) -- Using it to message everyone.
Message("Hello Player", 5, game.Players["PLAYERNAME"].PlayerGui) -- Using it to PM.
-- Or if you want, you could just make it without the PM part and make it like this.
function Message(Text, Time)
local New = Instance.new("Message",game.Workspace)
New.Text = Text
wait(Time)
New:remove()
end
-- Example
Message("Hello World!", 5)
-- End of Script --
Or you would use GUIs like I do, because they look more professional, but scripting a whole Message GUI takes a little longer, so i'd just use Messages if I were you.
Well, I hope this helped.
- Kratos232
This discussion is preserved as it was. New answers, comments, and votes are closed.
