Need help filtering GUI text

I have some buttons which have script inside of them, it send a remote to the server to filter what’s on it but when I try to return the filtered text it gives me only Instance

local TextService = game:GetService("TextService")

game.ReplicatedStorage.FilterText:FireServer(script.Parent.Text)

game.ReplicatedStorage.FilterText.OnClientEvent:Connect(function(plr, text) 
	script.Parent.Text = text
end)

Local script ^

local TextService = game:GetService("TextService")

game.ReplicatedStorage.FilterText.OnServerEvent:Connect(function(plr, text) do
		local playerID = plr.UserId

		local isSuccessful, textFilterResult = pcall(TextService.FilterStringAsync, TextService, text, playerID, Enum.TextFilterContext.PublicChat)
		if isSuccessful then
		    local isSuccessful, str = pcall(textFilterResult.GetChatForUserAsync, textFilterResult, playerID)
		    if isSuccessful then
				game.ReplicatedStorage.FilterText:FireClient(plr, str)
		    else
		        warn("String failed to filter.")
		    end
		else
		    warn("String failed to filter.")
		end
		
		
	end
end)

Serverside ^

2 Likes

There is no default player argument for OnClientEvent event listeners, so just remove it so that your result is function(text).

Also happy birthday :smile:

1 Like