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

[Help] "MSG is not a valid member of Workspace" what?

Asked by 5 years ago

The code is for a color move game but when I try to run it I got this "MSG is not a valid member of Workspace" but I set MSG to Workspace please help.

01---- Locals
02local blue = game.Workspace.Model.Blue
03local red = game.Workspace.Model.Red
04local green = game.Workspace.Model.Green
05local yellow = game.Workspace.Model.Yellow
06 
07---- Main Code
08while true do
09    wait(1)
10    idkmath = math.random(1, 4)
11    if idkmath == 1 then --- bule
12        MSG = Instance.new("Message")
13        MSG.Parent = game.Workspace
14        MSG.Text = ("GO to bule")
15        wait(1)
View all 53 lines...
0
what line is this erroring at? ArtBlart 533 — 5y
0
oh nvm, the answer below is what you need ArtBlart 533 — 5y

1 answer

Log in to vote
1
Answered by
cfiredog 274 Moderation Voter
5 years ago

Replace game.Workspace.MSG:Remove() on line 16, 26, 36, and 46 with:

1MSG:Remove()

When creating a new message instance, the instance's name is set by default to "Message", so looking for "MSG" in the workspace will not find the message. You had already created a variable that has a reference to the message, so you can just use the variable rather than looking for it in the workspace.

0
:O thx bic_round 9 — 5y
Ad

Answer this question