So im trying to make a auto grammar system like vinns it basically corrects/add punctuation to ur message, heres the code i tried it didnt block the message it js sends the bubble chat
``
local TextChatService = game:GetService(“TextChatService”)
local Players = game:GetService(“Players”)
– Set to your custom channel, or keep “RBXGeneral” if you’re using default
local TextChannel = TextChatService:WaitForChild(“TextChannels”):WaitForChild(“RBXGeneral”)
– Format message: Capitalize + add punctuation if missing
local function autoFormatMessage(message)
message = message:lower()
message = message:gsub(“^%l”, string.upper)
if not message:match("[%.%!%?]$") then
message = message .. "."
end
return message
end
– Intercept player messages
TextChatService.OnIncomingMessage = function(message)
if message.TextSource then
local player = Players:GetPlayerByUserId(message.TextSource.UserId)
if player then
local original = message.Text
local formatted = autoFormatMessage(original)
-- Send corrected message
TextChannel:SendAsync(formatted, message.TextSource)
-- Suppress original
return Enum.TextChatMessageStatus.Suppressed
end
end
return Enum.TextChatMessageStatus.Unknown
end``