My phone system allows you to swear. How do I fix this?

I made a phone system that allows you to communicate / send messages to other players. The problem is you can swear and there’s no filtering at all. How do I fix this?


I use remote events to send the text that players type in the phone to other players. I didn’t even think this was possible…

local p = script.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	if game.Players:FindFirstChild(p.PlayerTarget.Text) then
		game.ReplicatedStorage.Remotes.GetMessage:FireServer(p.PlayerTarget.Text,p.Message.Text)
	else
		p.PlayerTarget.Text = "Invalid username!"
	end
end)

this is inside the send button ^

local event = game.ReplicatedStorage.Remotes:WaitForChild("GetMessage")

event.OnServerEvent:Connect(function(player,target,message)
	if game.Players:FindFirstChild(target) ~= nil then
		if game.Players:FindFirstChild(target):WaitForChild("MutedPlayers"):FindFirstChild(player.Name.."_folder") == nil then
			game.ReplicatedStorage.Remotes:WaitForChild("SendMessage"):FireClient(game.Players:FindFirstChild(target),player,message)
		end
	end
end)

^ this is inside the serverscriptservice.

local plr = game.Players.LocalPlayer
local playerGui = plr.PlayerGui
local inbox = playerGui:WaitForChild("MessageGui"):WaitForChild("Frame")
local store = inbox:WaitForChild("Holder"):WaitForChild("ScrollHolder")
local chat = script:WaitForChild("PlayerChat")

game.ReplicatedStorage.Remotes:WaitForChild("SendMessage").OnClientEvent:Connect(function(player,text)
	inbox.Visible = true
	for i, v in pairs(store:GetChildren()) do
		v.Position = v.Position + UDim2.new(0,0,0.13,0)
	end
	local c = chat:Clone()
	c.Parent = store
	c.Player.Text = player.Name
	c.TextInfo.Text = text
end)

this is inside the startercharacterscripts ^ it gets the message and displays it on the phone.

Read this entire article, it has lots of good information:

1 Like

You must FilterStringAsync() or your game might get moderated.

1 Like

Search up Chat:FilterStringForBroadcast(), use that. It doesn’t work in studio btw

1 Like

I’ve never hear of these. What’s the difference between FilterStringForBroadcast() and FilterStringAsync()?

FilterStringForBroadcast is a bit more strict, and FilterStringAsync is less strict. That’s basically it

1 Like