Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Roblox Text Filtering Function. How to extract message?

Asked by 3 years ago

Hi, I've been recently trying to test and so some stuff with the filtering function from the text service however I have no idea on how can I get the content out from the filter

game.ReplicatedStorage.Chat.SendMessage.OnServerEvent:Connect(function(player, message)

    local success, result = pcall(function()
        return TextService:FilterStringAsync(message, player.UserId)
    end)

    if success then

        print(result)

    end

end)

Whenever I print the result it just gives me an Instance and I can't find anything about it's content within the Roblox wiki, how can I extract the message from it?

1 answer

Log in to vote
1
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
3 years ago
Edited 3 years ago

The method FilterStringAsync of TextService returns a TextFilterResult Object. This Object contains it's own functions that allows you respectfully fit the filtered string for different cases.

In your case, you're looking for GetChatForUserAsync:

Result:GetChatForUserAsync(Player.UserId)
--// The argument supplied should correlate to the recipient's UserId.
Ad

Answer this question