In my game I have a custom chat that I put in that would allow players to talk more freely, but I'm afraid that some players will go abusing this and start swearing at other players or just use fowl language in general, I didn't want to resort to using normal Roblox chat because it filters half the things players say. I tried to look for a way to block specific words on you tube and free models but I didn't find anything. I had looked on the wiki and found FilterStringAsync but It still uses the normal Roblox chat filter. After fiddling with the script I came here for help, I would be very grateful to anyone who can help me, here is the script
function NewLabel(parent, msg, player) newchatline = Instance.new("TextLabel", parent) newchatline.Text = player.Name.. ": " ..msg newchatline.Size = UDim2.new(1,0,0,15) newchatline.Position = UDim2.new(0,0,1,-15) newchatline.Font = "SourceSansBold" newchatline.TextColor3 = Color3.new(1,1,1) newchatline.TextStrokeTransparency = 0 newchatline.BackgroundTransparency = 1 newchatline.BorderSizePixel = 0 newchatline.FontSize = "Size14" newchatline.TextXAlignment = "Left" newchatline.TextYAlignment = "Top" newchatline.ClipsDescendants = true newchatline.Name = "line1" end function UpdateOldLabels(Parent) for i,v in pairs(Parent:GetChildren()) do if v.Name:sub(1,4):lower() == "line" then local LineNumber = v.Name:sub(5) if LineNumber == "12" then v:Destroy() else v.Name = "line"..tostring(tonumber(LineNumber) + 1) v.Position = v.Position - UDim2.new(0,0,0,15) end end end end game:GetService("Players").PlayerAdded:connect(function(player) player.Chatted:connect(function(msg) for _,v in ipairs(game:GetService("Players"):GetChildren()) do UpdateOldLabels(v:WaitForChild("PlayerGui").ScreenGui.Frame) UpdateOldLabels(game:GetService("StarterGui").ScreenGui.Frame) NewLabel(v:WaitForChild("PlayerGui").ScreenGui.Frame, msg, player) NewLabel(game:GetService("StarterGui").ScreenGui.Frame, msg, player) end end) end)
You MUST use filter string async. That is a MUST if you do not use the ROBLOX provided filter, you can be subjected to a ban. (This is because people were cursing on custom chats.) Quote from roblox wiki: "Because filtering is so crucial for a safe environment, Roblox actively moderates the content of games to make sure they meet certain standards. If a game is reported or automatically detected to not use filtering, that game will be shut down until the developer takes the proper steps to apply filtering."- ROBLOX wiki writers Found on this page: Wiki Page