Can you have curse words in scripts?

So i want to make a curse word filter system, is it possible to for example have:

if text == "fuck" then
       text = "####"
end

would this be possible, or would my game get removed?

3 Likes

I don’t see any reason why would you do that,

You can make a curse words-list to detect when player says them and kick them + censor those words, but that’s not efficient.

Roblox does that automatically, dont disable filter chat or else your game [and maybe account] get deleted.

You dont really want to check for TONS of curse words, and that’s absolutely not efficient.

I’m not trying to filter chat, but text boxes.
i have this system where a player fills in a word, but i want them to be unable to use curse words

You still have to use roblox’s censor filter if other players are able to see it.

You can use filterasync and text service to censor those words

how would i put this into a script to make it work?

Here is how I simply implemented that into my admin model -

local filteredContext = game:GetService("TextService"):FilterStringAsync(arguments[3],player.UserId) 
local filteredString = filteredContext:GetNonChatStringForBroadcastAsync()
--Now you can use the filteredString as the `safe` string for every string value

where:
arguments[3] is the message
and player.UserId is the ID of the player whom the command is being executed on.

The first argument in the FilterStringAsync is the string you want to filter, the second is the user’s ID.

how do you find the player via a server script, or does this need to be in a local script?

In what reference you want to use this?

i have a text box where players can fill in words, i just want them to be unable to type any curse words

If others are supposed to see their text, use a remote and on the server provide the player’s id

That’s an inappropriate word, you know ?

If we use FilterStringAsync
1234567890 [number] can be filtered. :frowning:

my text box is unable to have letters in it, so this wouldnt be a problem

		local success, errorMessage = pcall(function()
			text = game:GetService("TextService"):FilterStringAsync(text, plr.UserId)
			text = feedback:GetNonChatStringForBroadcastAsync()
		end)

feedback would be the text the player has put in, right?

oh I edited :frowning: Sorry
(char limit )

Final script:

local success, errorMessage = pcall(function()
			text = game:GetService("TextService"):FilterStringAsync(text, plr.UserId)
			text = feedback:GetNonChatStringForBroadcastAsync()
 end)

if success then
-- next code
 else
warn(errorMessage)
end
1 Like

“feedback” is giving me an error, what is it supposed to be reffering to?