chat.AddText (attempt to index global 'chat' (a nil value))

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 :stuck_out_tongue:

Or you can use

(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


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

net.Receive(“notify”, function ()
message = net.ReadString()
chat.AddText(Color(0, 170, 255), message)

That should work… let me know if it doesn’t and I can try to help you