Filtering Surface Guis?

Say I have a text button every time you press it, it changes a text label inside a surface GUI to anything that’s written in a text box.
I want to filter it since it can be inappropriate, is there’s a way to do so?

here’s the local script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextEvent = ReplicatedStorage.TextEvent -- The remote event yes
local Sreen = script.Parent
local TextBox = Sreen.TextBox
local TextButton = Sreen.TextButton

local function pressed()
	local text = TextBox.Text
	if text ~= "" then 
		TextEvent:FireServer(text) -- firing the remote event yes
	end
end

TextButton.MouseButton1Click:Connect(pressed)

Script :

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextEvent = ReplicatedStorage.TextEvent -- The remote event yes

local part = script.Parent
local TextLabel = part.SurfaceGui.TextLabel -- The text label yes

local function yes(player, text) 
	TextLabel.Text = text -- Changing the text
end

TextEvent.OnServerEvent:Connect(yes)

Thanks. (sorry for my lack of English)

Yes, you can filter the text with TextService | Roblox Creator Documentation

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextService = game:GetService("TextService")
local TextEvent = ReplicatedStorage.TextEvent -- The remote event yes

local part = script.Parent
local TextLabel = part.SurfaceGui.TextLabel -- The text label yes

local function yes(player, text)
	local success, result = pcall(function()
		return TextService:FilterStringAsync(text, player.UserId)
	end)
	if success then
		local filteredtext = result:GetNonChatStringForBroadcastAsync()
		TextLabel.Text = filteredtext -- Changing the text
	end
end

TextEvent.OnServerEvent:Connect(yes)