Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a message with a script?

Asked by 10 years ago

I always wondered if you can make a message with a script. Example: I wanted to say Hello World! then wait 5 seconds.

2 answers

Log in to vote
4
Answered by
ImageLabel 1541 Moderation Voter
10 years ago
z = Instance.new('Message', workspace)
z.Text = "Your message"
wait(5)
z:Destroy() 

;]

Ad
Log in to vote
0
Answered by
Kratos232 105
10 years ago

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

Answer this question