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

Why wont these text filtering scripts return filtered text?

Asked by 5 years ago

Ive set up this script that should filter text from the string value "summary" but when it is invoked by the client, it simply returns the unfiltered text?

Script:

local summary = game.ReplicatedStorage.Summary.Value
function Filter()
    local TextService = game:GetService("TextService")
    local sumname = game.ServerStorage.Summarizer.Value
    local summarizer = game.Players[sumname].UserId
    local filteredMessage = ""
    summary = game.ReplicatedStorage.Summary.Value
    success, errorMessage = pcall(function()
        text = TextService:FilterStringAsync(summary, summarizer)
    end)
    if success then
        return text
    elseif errorMessage then
        print("Error filtering message:", errorMessage)
    end
end 

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

function sendFiltered()
    wait (0.1)
    local TextService = game:GetService("TextService")
    local sumname = game.ServerStorage.Summarizer.Value
    local filteredMessage = ""
    success, errorMessage = pcall(function()
        filteredMessage = text:GetNonChatStringForBroadcastAsync()
    end)
    if success then
        return filteredMessage
    elseif errorMessage then
        print("Error filtering message:", errorMessage)
    end
end

game.ReplicatedStorage.Filter.OnServerInvoke = sendFiltered

Thanks in advance!

1
if you’re testing it in studio, it will not work. text filtering only works on a real server. LeadRDRK 437 — 5y
0
^^^^^ User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I had the same question but after a while of messing around with my script i found out that text filtering only works in game servers

try running that script in a game server and see if it works also the script has to be server-sided

0
i think the8bitdude11 358 — 5y
Ad

Answer this question