• chat.AddText (attempt to index global 'chat' (a nil value))
    7 replies, posted
So yeah, that's my error. I'm trying to use it in a function. I assume the chat. doesn't exist because it's a nil value.
Use it clientside, not serverside.
I need it for a gamemode though, so doesn't that mean it has to be serverside?
Send a message from the server and use clientside code to catch the message and do chat.AddText
Still new to lua lol. Sorry :P
Or you can use [LUA] BroadcastLua("chat.AddText()") [/LUA] EDIT: (Oh, I didn't know he wanted to send it to one person xD)
Unless he only wants player B to run it?
Oh, haha, I was really tired when I said that, here is what he wants Server [LUA] util.AddNetworkString("notify") net.Start("notify") net.WriteString(msg) -- This is the message you're sending to client, change msg to whatever net.Send(ply) -- ply is the player that you are sending the message to [/LUA] Client [LUA] net.Receive("notify", function () message = net.ReadString() chat.AddText(Color(0, 170, 255), message) end) [/LUA] That should work... let me know if it doesn't and I can try to help you
Sorry, you need to Log In to post a reply to this thread.