Get Non Chat String For Broadcast Async is returning Instance instead of String?

Hello,

I’m currently trying to filter text using TextService, FilterStringAsync, and GetNonChatStringForBroadcastAsync. However, when I try to filter text using GetNonChatStringForBroadcastAsync, it always returns Instance.
image
Here’s the code for the server:

-- above code for event
local textService = game:GetService("TextService") -- defined outside of event
local txtObject = textService:FilterStringAsync(message, plr.UserId)
local msgFiltered = txtObject:GetNonChatStringForBroadcastAsync()

print(tostring(msgFiltered)) -- print debug
-- more code for receiving message

Does anybody know why this is happening? I read the documentation and it should be returning a string.

I think filtering doesn’t work in studio. Can you try testing the game on the Roblox Player? Also, you should wrap all the Text Filtering Functions in a pcall since they make web requests which can fail. Here’s an article on filtering: Text Filtering | Roblox Creator Documentation

It is still returning Instance, but in client logs, it returns the message.
image
image

I’m not really sure what’s happening then, sorry.

1 Like