The nesting of the first snippet of code is ridiculous. You should really narrow that down.
If you’d bother to explain what you (guys) are trying to do step by step, it’d be a little easier to understand.
What I got from this was:
- Player(1) presses a button on a menu.
- Gets sent to the server. (Via a net message I’d assume?)
- Gets re-broadcasted (again, via a net message?) to every player and goes through the original snippet you posted.
A better way to go about this would be like:
- Player presses button.
- Sent to server, goes through the checks - in a more efficient manner.
- Run player:ChatPrint(msg) serverside instead of sending it via another net and clogging net space with garbo.
Button.DoClick = function()
--Write whatever data is needed (idk if there was any)
--Run through the checks
v:ChatPrint() -- Chat Print
For further explanation, basically it’s not working because you’re trying to send a message from a client directly to other clients.
The only way that it’ll work is if you send it from the server or use the method I provided above.