Whenever I invoke this function, when I recieve the string from the server i just get the error attempt to call a string value twice.
Server Script:
function Filter()
if game.ServerStorage.Summarizer.Value == "" then
wait (16)
end
print ("2")
local sumname = game.ServerStorage.Summarizer.Value
local summarizer = game.Players[sumname].UserId
local TextService = game:GetService("TextService")
local filteredMessage = ""
local summary = game.ReplicatedStorage.Summary.Value
local success, errorMessage = pcall(function()
local filteredMessage = TextService:FilterStringAsync(summary, summarizer):GetNonChatStringForBroadcastAsync()
end)
if success then
return filteredMessage
elseif errorMessage then
print("Error filtering message:", errorMessage)
end
end
game.ReplicatedStorage.Filter.OnServerInvoke = Filter()
Local Script:
function SetSummary()
script.Parent.Text = game.ReplicatedStorage.Filter:InvokeServer()
end
game.ReplicatedStorage.OpenVoting.OnClientEvent:Connect(SetSummary)
Thanks in advance!

1 comment
because of line 21. Remove the brackets as with that assigns OnServerInvoke to what the function returns. By removing the brackets you are assigning the function itself and not what it returns. Also line 16 will ALWAYS run if the condition for line 14 were to be false, as strings are truthy values, so just put "else" instead of "elseif errorMessage then".