Hey there! I’m making an admin panel for my friend’s game and I decided to add a system message command. I decided to add a filter in case someone tries to say something rude.
However, it doesn’t filter. Here’s my current code:
elseif script.Parent.Parent.TextLabel.Text == "System Message" then
local StarterGui = game:GetService("StarterGui")
local text = script.Parent.Parent.TextBox.Text
local textsplit = string.split(text, " ")
local finaltext = ""
for i = 1, #textsplit do
for j = 1, #unallowedwords do
if textsplit[i] == unallowedwords[j] then
local badword = unallowedwords[j]
if #badword == 3 then
textsplit[i] = "###"
elseif #badword == 4 then
textsplit[i] = "####"
elseif #badword == 5 then
textsplit[i] = "#####"
end
end
end
finaltext = finaltext..textsplit[i].." "
end
repeat
wait()
local Success = pcall(function()
StarterGui:SetCore("ChatMakeSystemMessage", {
Text = text;
Color = Color3.fromRGB(0, 0, 0);
Font = Enum.Font.Cartoon;
TextSize = 18
})
end)
until Success
end
Thanks for stopping by to help!
(I’m not that good at scripting)