For the record, I know this is the way most prescribe overwriting the default modules (and adding new ones) to the chat. By the end of this post you’ll understand why this doesn’t cut it.
I’ll start by just saying why I need to do this. Here’s the problem I’m solving. If your TeamColor is white, then another player can fool everyone into thinking you chatted by spamming the first line of their chat message with filler characters and then beginning the second line with your name as it would appear had you chatted. However, I have other reasons for wanting to overwrite the default chat modules too, so this isn’t the only thing I want to do with this knowledge.
The code in the Lua Chat System that decides name color is in ExtraDataInitializer. All I do is make it so if your chat name color is gonna be white, it just defaults to the regular name color. Here’s the fix.
Yes I know the W in Institutional white
isn’t supposed to be capitalized, I just didn’t feel like re-recording the gif.
While using the method at the beginning of this post does work, it isn’t sufficient. You see, my group Temple of Brickbattle and by extension the group Brickbattle Maps Archive both use a “master script” that looks like this in the ServerScriptService of every group game. This imports all of the assets each of these games rely on: the tool set, the tool order editor GUI, the spectate GUI, the toggle-able classic animations, the leaderboard, the admin commands, and other various gadgets.
You can understand why this is extremely useful: it allows me to create and update possibly 30 games at once without having to open any of them, just by inserting or editing code in the module that’s acquired by the MasterScript. While I’m not sure this was the intended use of importable ModuleScripts, it does work very well. Think of it almost like InsertService.
My goal here is to incorporate this replacement ExtraDataInitializer
and its installer into the master script alongside all of the other things it uses.
Now for the issue with overwriting default chat modules. Requiring an onsite module takes a little bit of time. Enough time, in fact, that it’s not guaranteed to paste the ChatModules folder in its proper location (see the first link in this thread) before the chat service has already require
d all of the stock default modules. Obviously if I just parented the replacement module to game:GetService("Chat"):WaitForChild("ChatModules")
, that wouldn’t work either, because then it would just be an unused duplicate of the default thing. Deleting the original wouldn’t work for even more obvious reasons.
How can I replace default chat modules with my own modified versions late, while guaranteeing they work? Pinging chat expert @colbert2677.