Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Custom chat not working when I attempt to filter string value?

I made a custom chat that works perfectly when I don't try to add a filter. When I do, though, everytime I chat the custom chat display shows "Value". I never have done text filtering before so that's probably why. I looked at the wiki but I don't really get it... This is one of the local scripts for the custom chat:

chatbar.FocusLost:connect(function(EnterPressed)
	if EnterPressed and chatbar.Text ~= nil and chatbar.Text ~= " " then
		
		local message = chatbar.Text
		local plr = chatbar.Parent.Parent.Parent
		local chatstorage = game.Workspace:WaitForChild("ChatStorage")
		local plrmessage = Instance.new("StringValue", chatstorage)
		-- filter stuff starts here
		local sucess, message = pcall(function()
			local filteredtext = message:FilterStringAsync(message)

		
		plrmessage.Name = plr.Name..": "..filteredtext -- filter stuff ends here

		wait(0.1)
		chatbar.Text = "Press \"/\" to chat!"
		end)
	end
end)

Yeah, I'm clueless of how to filter this. Can someone help?

1 answer

In line 13, you are setting the name instead of the value property of the string value. Change it to this:

plrmessage.Value = plr.Name..": "..filteredtext -- filter stuff ends here

2 comments

0

The filtering still doesn't work. When I say something that roblox would censor such as "oder" or any number, it doesn't get censored.

0

Also, the textbutton doesn't reset and the chat display doesn't show anything.

This discussion is preserved as it was. New answers, comments, and votes are closed.