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

Filtering Text Isn't Filtering Properly?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
1
Answered by 3 years ago

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)
Ad
Log in to vote
0
Answered by 3 years ago

It Seems That This Works As Well

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

Answer this question