Honestly I find it much easier to make my own custom chat than to put patchwork on Roblox’s chat
No worries, we all make mistakes. I should’ve caught on you didn’t need help anyways.
Happy coding!
Wait a moment. I’m having very dumb moments.
I’m very tired and I thought we’ve been on Scripting Support this entire time. Sorry man. No need to move, turns out I’m just too tired to be on the internet right now. Speaking of, I’m going to get to bed.
I was searching via the scripting
tag, not the Scripting & Support
area. Oops.
Again, sorry!
Just for fun, I wrote a small script to spam the remote. Turns out, the data does still end up getting sent to every client, even when messages are sent each frame. My ping skyrockets, along with everyone else in the game, until we all get kicked . Have a look:
local msg = ("A"):rep(2e5)
local r =game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest
local rs = game:GetService("RunService").RenderStepped
rs:Connect(function()rs:Connect(function()r:FireServer(msg,"All")end)end)
Roblox by default should have a character cap on the server before sending it to other clients.
They definitely should, but for some reason it hasn’t appeared since its release in 2016.
This seems like a reasonable solution to me. This is how I’ve interpreted wow13524’s solution:
- First you need to Fork the Lua Chat System, if you haven’t already.
- Next, modify file Chat > ChatServiceRunner and modify
SayMessageRequest
as follows (substituteKICK_MESSAGE_LEN
with a larger value if you need larger chat messages)
local KICK_MESSAGE_LEN = 300
EventFolder.SayMessageRequest.OnServerEvent:connect(function(playerObj, message, channel)
if type(message) ~= "string" then
return
end
if type(channel) ~= "string" then
return
end
local messageLen = string.len(message)
if messageLen > KICK_MESSAGE_LEN then
if playerObj then
playerObj:Kick("Exceeded max msg length.")
end
return
end
local speaker = ChatService:GetSpeaker(playerObj.Name)
if (speaker) then
return speaker:SayMessage(message, channel)
end
return nil
end)
I have only tested this briefly, so please test it yourself before using it. Let me know if I’ve missed anything.