Needing help with RemoteFunctions

I want to achieve when you press enter inside a textbox a RemoteFunction will trigger and put the string inside the textbox through filtering and send it back to the localscript.

I don’t get any errors but it also doesn’t do anything.

This is my first time working with a RemoteFunction

Localscript:

local TextBox = script.Parent
local localplayer = game:GetService("Players").LocalPlayer
local FilterFunction = game.ReplicatedStorage.Functions:WaitForChild("FilterFunction")

local function SendMessage(message)
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
		Text = message,
		Color = Color3.fromRGB(150, 177, 255)
	})
end

TextBox.FocusLost:connect(function(enterPressed)
	if enterPressed then
		local Result = FilterFunction:InvokeServer(script.Parent.Text,"System123")
		return SendMessage(Result)
	end
end)

Modulescript:

local FilterString = {}

function FilterString:Filter(String,Player)
	local TXTS = game:GetService("TextService")
	local success,ErrorMessage = pcall(function()
		TXTS:FilterStringAsync(String,Player.UserId)
	end)
	if success then
		return FilterString
	else
		return warn("Something went wrong while filtering: "..String.." Error: "..ErrorMessage)
	end
end

return FilterString

Script:

local FilterFunction = game.ReplicatedStorage.Functions:WaitForChild("FilterFunction")
local FilterString = require(game.ServerStorage.ServerOnlyModules.FilterString)
FilterFunction.OnServerInvoke = function(Player,message,forwhat)
	if forwhat == "System123" then
		local FilterdMessage = FilterString:Filter(message,Player)
		
		return FilterdMessage
	end
end

You have to use GetChatforuser(userid(can be any userid)) when filtering text

Well, it doesn’t do anything but to what extent?

Does it not return the string, or does it not filter the string?

If the answer is it does not filter the string that is because Studio does not filter anything - even the default chat in studio is unfiltered, you can test it yourself.

I honestly don’t know, all i can say is it doesn’t return the string

Can you send me a link from Developer.roblox.com of this function?

I can not find it…

Here are two API References for filtering string:

FilterStringForBroadcast
FilterStringAsync

Reviewing the info on the api, it appears your using the wrong params for FilterStringAsync()

However, the else statement might not be working correctly cus you’re trying to return a warn statement. However that’s just a guess don’t take me verbatim on that.

Also I’d like to point out that it returns a filtered string which you are not capturing;
you may want to try

local FilteredString;
local sucess, ErrorMessage = pcall(function()
    FilteredString = TXTS:FilterStringAsync(String, Player1, Player2)
end)