function SendText(Tag,Text) local Removeable = {"!","@","#","$","%","^","&","*","(",")","_","-","+","=","{","[","}","]","|","\",","~","`","<",",",">",".","","?","/"} for i = 1,string.len(Text) do for i = 1, #Removeable do if string.find(string.lower(Text),Removeable[i]) then NewText1 = string.gsub(string.lower(Text), tostring(string.reverse(string.lower(Removeable[i]))),string.rep("x",string.len(Removeable[i]))) Aproved = false NewText = NewText1 end end end game.Workspace.ServerChat.NewChat:FireServer(Tag,NewText,true) end
Error is:
Players.Player1.PlayerGui.Chat.ChatResponse:15: malformed pattern (ends with '%')
As the wiki states, "To search for a literal magic character, precede it by a % - for example, to look for a percent symbol, use %%."
So, all you have to do is escape all of the magic characters:
function SendText(Tag,Text) local Removeable = {"!","@","#","%$","%%","%^","&","%*","%(","%)","_","%-","%+","=","{","[","}","]","|","%\",","~","`","<",",",">","%.","","%?","/"} for i = 1,string.len(Text) do for i = 1, #Removeable do if string.find(string.lower(Text),Removeable[i]) then NewText1 = string.gsub(string.lower(Text), tostring(string.reverse(string.lower(Removeable[i]))),string.rep("x",string.len(Removeable[i]))) Aproved = false NewText = NewText1 end end end game.Workspace.ServerChat.NewChat:FireServer(Tag,NewText,true) end
Hope this helped.