Can you have curse words in scripts?

how would i do this if i want it to be affected to every user though?

Can you tell me more about what you make?

i have a text box, and letters are scattered around the map, you collect the letters and u can fill them into the text box, but i want to filter out the bad words

that mean text that you want to change, that doesn’t typed by player?

No, i want to make it so when a player types a bad word into the text box, it turns into hashtags

then you should replace plr.UserId to player’s UserId who typed.

how would i do this though?
(char limit)

Can I see script that handle typing?

local TextBox = script.Parent.Parent.TextBox

function onClick(click)
	local inv = click.PlayerGui.Letters.Frame
	local letter = script.Parent.Name
	
	if inv[letter].Amount.Value.Value >= 1 then
		TextBox.SurfaceGui.Frame.TextLabel.Text = TextBox.SurfaceGui.Frame.TextLabel.Text..letter 
		inv[letter].Amount.Value.Value = inv[letter].Amount.Value.Value - 1
	end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)

Is that local script?
(char limit ) )

no, a server sided script
(char)

Can you get player instance who typed?

yes, click is in this case the player

then Click mean player, so

click.UserId

Please take this to PMs. You guys are clogging the post like crazy.

Hello there. So, to answer your initial question, you actually can have bad words in your scripts, but under the condition that they do not show on the client (so a player cannot see them). Read more about this here. Regardless, considering that you are trying to filter text, it is much better that you use the TextService:FilterStringAsync() function as you will be ensuring that you aren’t breaking any ToS. Keep in mind that any bypassers could cause harm to your account and game if you use a custom filter and do not filter properly, hence why most people just use the FilterStringAsync() as the filtering is taken care of by Roblox. All in all, I suggest you stick with the FilterStringAsync() function unless you have a specific reason not to. More information on the usage of the function here. You could also use other filtering functions when appropriate. Here is a resource about text and chat filtering:
https://create.roblox.com/docs/building-and-visuals/ui/text-and-chat-filtering

As long as its used for filter purposes, I think you should be fine, although I highly suggest to use TextService for filtering just like others suggest you to.

DISCLAIMER: I’m not entirely sure if this is true or not, but correct me if it’s wrong.

I did this for my game Talk To A Computer, because I needed the computer to kick the user if they said a bad word.
So yes it is definitely possible to do that except I recommend using string:match(“bad word here”)
because then you can detect a bad word anywhere in the message. For example if someone said “f*** you noob”, your current script would not censor the bad word. But if you use string:match(“f***”) you’d be able to detect the word anywhere in the message.