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 |
02 | local blue = game.Workspace.Model.Blue |
03 | local red = game.Workspace.Model.Red |
04 | local green = game.Workspace.Model.Green |
05 | local yellow = game.Workspace.Model.Yellow |
06 |
07 | ---- Main Code |
08 | while 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 ) |
Replace game.Workspace.MSG:Remove()
on line 16, 26, 36, and 46 with:
1 | MSG: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.