MessagingService:PublishAsync(): Cannot publish Instance, can only accept valid UTF-8 characters

I’m trying to filter a string, which is the text for a global announcement, whenever I try it throws this error:
“MessagingService:PublishAsync(): Cannot publish Instance, can only accept valid UTF-8 characters.”
Here’s the code in server script service:

local filteredText
recieveMessage.OnServerEvent:Connect(function(player, message)
	local success, err = pcall(function()
		filteredText = textService:FilterStringAsync(message, player.UserId)
	end)
	messageService:PublishAsync("GlobalAnnouncement", filteredText)
end)```

Does it work without the text being filtered?

1 Like

Yeah it just stopped working when I tried to filter it.

Try printing the filtered string and see what comes out.

1 Like

It prints Instance, I don’t think :FilterStringAsync() returns a string, I have no idea how I would convert it to a string.

That would be your answer. You would need to use this: TextFilterResult | Roblox Creator Documentation

2 Likes