Hello!
I’m having a little issue with using the escaped form of specific characters with using RichText and I don’t know how to fix it.
If I type this into my chat,
It goes through Roblox’s filter and then the filtered string gets replaced with the escaped form. The problem is that the escaped form still shows as normal. So when I press enter,
It doesn’t happen with the ampersand though. It does happen with everything else though.
Relevant section of the script:
local escapedForms = {
['&'] = '&';
['<'] = '<';
['>'] = '>';
['"'] = '"';
['\''] = ''';
}
createChatRequest.OnServerEvent:Connect(function(player, messageContent)
local rankData = permissionHandler:GetRankInfo(player) -- Similar to ExtraData
local length = string.len(messageContent) -- Gets the length
if length >= 200 then
messageContent = string.sub(messageContent, 1, 200) -- Ensure the limit can't pass 200 chars
end
coroutine.wrap(function() -- Flood detection
if chats[player] then
chats[player] += 1
else
chats[player] = 1
end
wait(5)
chats[player] -= 1
end)()
if chats[player] <= 5 then
for i,playerTo in pairs(players:GetPlayers()) do
local outputString = chat:FilterStringAsync(messageContent, player, playerTo)
permissionHandler:GetRankInfo(player)
local currentString = outputString
for i,v in pairs(escapedForms) do -- Part where the string is substituted with its escaped form
if string.find(currentString, i) then
currentString = string.gsub(currentString, i, v)
end
end
rankData['PlayerName'] = player.Name
if not rankData['TagColour'] then
rankData['TagColour'] = nameColour:GetNameColour(player.Name)
end
fireClientChat:FireClient(playerTo, currentString, rankData)
end
else
local systemRankData = permissionHandler.RankInfo.System
systemRankData['PlayerName'] = 'System'
fireClientChat:FireClient(player, 'You have been muted for 5 seconds due to potential spam!', systemRankData)
end
end)
TIA for any help!