is there a way to make a grammar auto collete system where on the ROBLOX chat when you type something in send it if it well caches the grammar mistake in it well fix the mistake once the message in the ROBLOX chat sends on your game
Hi, I have just gone and renamed and move your topic to Development Support!
And yes, there is a way to make a grammar auto-correct in ROBLOX!
Check out this post…
1 Like
I made an auto-grammar correction system recently that works with TextChatService instead of LegacyChatService.
If you want the script, then let me know! =D
Can i please have the script?
This does not work in bubble chat.
Sure! Here is the script with the setup instructions:
Setup
Make an LocalScript in StarterPlayerScripts called “AutoGrammar” and then paste this code in there:
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local GROUP_ID = 1234567 -- important! replace with your group id
local ALLOWED_RANKS = {
[255] = true,
[254] = true,
[253] = true,
[252] = true,
[251] = true,
[250] = true,
[249] = true,
}
local corrections = {
["idk"] = "i don't know",
["brb"] = "be right back",
["omg"] = "oh my god",
["u"] = "you",
["r"] = "are",
["pls"] = "please",
["thx"] = "thanks",
["btw"] = "by the way",
["im"] = "i'm",
["havent"] = "haven't",
["didnt"] = "didn't",
["rblx"] = "Roblox",
["hru"] = "how are you",
["hbu"] = "how about you",
["wth"] = "what the heck",
["np"] = "no problem",
["ty"] = "thank you",
["tysm"] = "thank you so much",
["yh"] = "yeah",
["ngl"] = "not gonna lie",
}
local function correctMessage(message)
local words = string.split(message, " ")
for i, word in ipairs(words) do
local lowerWord = string.lower(word)
if corrections[lowerWord] then
words[i] = corrections[lowerWord]
end
end
local correctedMessage = table.concat(words, " ")
correctedMessage = correctedMessage:gsub("^%l", string.upper)
local lastChar = correctedMessage:sub(-1)
if not (lastChar == "." or lastChar == "!" or lastChar == "?") then
correctedMessage = correctedMessage .. "."
end
return correctedMessage
end
local function onTextChatMessage(message, properties)
local player = Players:GetPlayerByUserId(properties.UserId)
if player then
local rank = player:GetRankInGroup(GROUP_ID)
if ALLOWED_RANKS[rank] then
local correctedMessage = correctMessage(message.Text)
message.Text = correctedMessage
end
end
end
TextChatService.OnIncomingMessage = function(message)
local properties = message.TextSource
onTextChatMessage(message, properties)
end
Make sure to replace your group ID and the ranks you want to be autocorrected.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.