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

[SOLVED] Why is attempt to index local 'mes' (a nil value)?

Asked by 6 years ago
Edited 6 years ago

The local script in StarterPlayerScripts and FilteringEnabled is on.

Part of local script:

    network:add("chatted",function(chatter,text,tag,teamchat)
        if teamchat and chatter.TeamColor~=player.TeamColor then return end
        local mes=msg:Clone()
        local mtag=mes:WaitForChild("Tag")
        local offset=5
        mes.Parent=globalchat
        mtag.Text=tag
        if tag~="" then
            offset=mtag.TextBounds.x+5      
            mes.Position=ud2(0.01,offset,1,20)
            mtag.Position=ud2(0,-offset+1,0,0)
        end
        mes.Text=chatter.Name..": "
        mes.TextColor=chatter.TeamColor
        mes.Msg.Text=text
        mes.Msg.Position=ud2(0,mes.TextBounds.x,0,0)

    end)

Output: "attempt to index local 'mes' (a nil value)"

Error line is 04: 'local mtag=mes:WaitForChild("Tag")'

It's not working. Why?

0
how did you solve this? outlook1234567890 115 — 6y

Answer this question