Ive been working on a text filter script but I cant test it due to the functions never triggering.

If I look at scripts in the developer console the rate for the script spikes but activity remains at 0%

Script:


function Filter()
	print("2")
    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.2)
    local TextService = game:GetService("TextService")
    local sumname = game.ServerStorage.Summarizer.Value
    local filteredMessage = ""
    success, errorMessage = pcall(function()
        filteredMessage = text:GetNonChatStringForBroadcastAsync()
    end)
    if success then
        game.ReplicatedStorage.FilteredSummary.Value = filteredMessage
    elseif errorMessage then
        print("Error filtering message:", errorMessage)
    end
end

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

Thanks in advance!

3 comments

0

Do you have a client actually firing the event?

0

Yes ^

0

Can we see the local script?