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

Why does It say this?

Asked by 10 years ago
M = game.Workspace.Message

MessageText = game.Workspace.Message.Text

M.MessageText = "This is a place for scripts!, so why ya here. i got cameras!"
wait(5)
M.MessageText:Destroy()
M.MessageText = "This"
wait(1)
M.MessageText:Destroy()
M.MessageText = "is"
wait(1)
M.MessageText:Destroy()
M.MessageText "a place for scripts. Like this message thingy."
wait(3)
M.MessageText:Destroy()

That is my message script. So I named something called MessageText for shortcut. In the output it says that MessageText is not a valid member of Message. Why?

0
Variables can't be assigned to a property. Also how is that a shortcut? xD M.MessageText is longer than M.Text infalliblelemon 145 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

You can't make a variable of the Message's value.

You could do this:

local msg = workspace.msg

But not this:

local msg = workspace.msg.Text

This code, however, works and is much simpler.

local msg = game.Workspace.Message
local msgs = {"This is a place for scripts! Why're you here? I got cameras!","This","is","a place for scripts. Like this message thingy."}

for i, v in pairs(msgs) do
    msg.Text = v
    wait(1)
end

Ad
Log in to vote
-1
Answered by 10 years ago

(All of this is assuming that you have a message in the workspace.)

You are calling the shortcut wrong. Basically what you did wrong was you made two shortcuts, when you only needed one, and you called both shortcuts at the same time, saying that the second shortcut was a child of the first. M.MessageText is nil, or nonexistant.

MessageText is existant.

Another error you made is that you destroyed the message after everything, meaning that you completely erased it from the game. You cannot change the text of an erased message.

Your script should look like this:

MessageText = game.Workspace.Message.Text
MessageText = "This is a place for scripts!, so why ya here. i got cameras!"
wait(5)
MessageText = "This"
wait(1)
MessageText = "is"
wait(1)
MessageText "a place for scripts. Like this message thingy."
wait(3)
MessageText:Destroy()--I left this one here because now you could completely remove the message from workspace, as you are done using it.

Answer this question