So I have this text filtering script and ive set it up so two different functions make the text into a textobject and then into a string. It fails in the first function and I suspect that

textobject = TextService:FilterStringAsync(summary,players)

Is the error as the game prints "filtering 2"

Full function:

	local success, message = pcall(function()
		print ("filtering 2")
		textobject = TextService:FilterStringAsync(summary,players)
	end)

Full script:

local function Filter()
	wait(1)
	print("filtering text")
	TextService = game:GetService("TextService")
	local summary = game.ReplicatedStorage.Summary.Value
	local players = game.Players:GetChildren().UserId
	local success, message = pcall(function()
		print ("filtering 2")
		textobject = TextService:FilterStringAsync(summary,players)
	end)
	if message then
		print("broken")
	end
	if success then
		local worked, errorMessage = pcall(function()
			print("filtered")
			filteredtext = textobject:GetNonChatStringForBroadcastAsync()
		end)
		if worked then
			game.ReplicatedStorage.Summary.Value = filteredtext
		end
	end
end

game.ReplicatedStorage.Filter2.OnServerEvent:Connect(Filter)

The function Filter and success DO trigger, that isnt the problem. Thanks for any help!

3 comments

0

any output errors?

0

if not print message and see what it prints

0

FilterStringAsync takes three arguments. String, player from, player to - you are only providing two (a value and a table). You need to iterate each player so the string will cater to them specifically.