I am trying to make a Character Name System for a game of mine, and I am running into an issue with the Text Filtering, so people don’t have slurs or other stuff as there name,
The main problem is that it filters everything instead of just stuff that would be tagged
SERVER SCRIPT
local Censored = false
local rolled = false
Event2.OnServerEvent:Connect(function(player,Value1,Value2)
if rolled == true then
return
end
local PlayerStats = Stats:FindFirstChild(player.Name)
local ts = game:GetService("TextService")
local text = Value2
local filteredtext = ts:FilterStringAsync(text,player.UserId):GetNonChatStringForBroadcastAsync()
if filteredtext then
Event2:FireClient(player)
Censored = true
return
end
LOCAL SCRIPT
PlayerNameBox.FocusLost:Connect(function()
local text = PlayerNameBox.Text
Value2 = text
end)
Frame.Confirm.MouseButton1Up:Connect(function()
if Value1 == nil then
return
end
if Value2 == nil then
return
end
Event2:FireServer(Value1,Value2)
end)
Event2.OnClientEvent:Connect(function()
Frame.PlayerName.PlaceholderText = "Censored, Please Try again."
Frame.PlayerName.Text = "Censored, Please Try Again"
end)