Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a filtering system?

Asked by
Bisoph 5
6 years ago
Edited 6 years ago

I tried to remake Roblox's old chat system. It works, but I know I need to make it filter so my game doesn't get banned.

For the filtering system, I wrote this:

--Server Script--
local TextService = game:GetService('TextService')

function game.ReplicatedStorage.FilterText.OnServerInvoke(toPlayer, fromPlayer, txt)
    print(toPlayer, fromPlayer
    )
    local textObject
    local s = pcall(function()
        textObject = TextService:FilterStringAsync(txt, fromPlayer.UserId)
    end)
    if s then
        return textObject:GetChatForUserAsync(toPlayer.UserId)
    else
        return '???'
    end
end
--Chat Script--
--some lines of code...
function Chat:ApplyFilter(str, fromPlayer)
    --[[for _, word in pair(self.Filter_List) do 
        if string.find(str, word) then 
            str:gsub(word, '@#$^')
        end 
    end ]]  
    return game.ReplicatedStorage.FilterText:InvokeServer(fromPlayer, str)
end
--more unimportant lines of code...

local text = Chat:ApplyFilter(message, cPlayer)
        mLabel.Text = nString .. text;

--even more unimportant lines of code...

I'm not sure if it's an error or not, but when I try to say something that usually gets filtered when I play Roblox, it doesn't. Please help me fix this!

EDIT: wait it worked all along nvm

1 answer

Log in to vote
1
Answered by 6 years ago
game:Destroy()
0
XD User#17125 0 — 6y
0
10/10 answer TheeDeathCaster 2368 — 6y
0
im reporting dun dun dunnnnn (not really) Bisoph 5 — 6y
Ad

Answer this question