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

Filtering Text Isn't Filtering Properly?

So I Have Sent A Event Through The Client To The Server To Filter A Text But When Is Sent Through Text It Prints "Instance"? And I Have No Clue Why

This Is My Server Script

game.ReplicatedStorage.Law.Law1.OnServerEvent:Connect(function(Plr,Law)
	local filteredTextResult
	local success, errorMessage = pcall(function()
		filteredTextResult = game.TextService:FilterStringAsync(Law, Plr.UserId)
	end)
	print(filteredTextResult)
end)

Client Script

script.Parent.Law1.InputEnded:Connect(function()
	game.ReplicatedStorage.Law.Law1:FireServer(script.Parent.Law1.Text)
end)

2 answers

✓ Accepted answer

I also got confused by this when I did a custom chat but for some reason that returns a "TextFilterResult" instead of the filetered string. To get the filtered string you'll need to add this after line 5:

local FilteredMessage = result:GetChatForUserAsync(Plr.UserId)

It Seems That This Works As Well

local filteredTextResult = game.Chat:FilterStringForBroadcast(Law,Plr)

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