Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to filter a text in GUI element?

I tried looking in the wiki, I still don't really get on how to fix this...

local date="5 november"
	local text1 = date
local filteredTextResult = TextService:FilterStringAsync(text1,playerID)
GUI.Frame.DateText.Text = filteredTextResult

Doesn't seem to work... Any suggestions???

1 answer

It seems that you are attempting to filter text via a localscript, if so the script wont work at all. Text filtering is via the server and not the client.

Here's how to fix it.

So just chuck a remote function in replicated storage first.

Now this is the script I wrote awhile back for filtering text in my suggestion system.

CLIENT SCRIPT

local MSGA = "Your text"
local player = game.Players.LocalPlayer --gets local player
local filterString = game.ReplicatedStorage.RemoteFunction:InvokeServer(MSGA) -- fire to serverscript

wait()

MSGA = filterString
wait(0.1)
print(MSGA)

SERVERSCRIPT (Serverscriptservice)

game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(player,MSG) -- Player that fired event, message to filter
    return game.Chat:FilterStringForBroadcast(MSG,player) -- send filtered message back to player
end

Its super simple once you understand how the client and server interact.

Hope this helps!

1 comment

0

Doesn't seem to work... I'm trying to run the "Clientscript" through a serverscript.. Anyways to filter through a serverscript? And not client?

This discussion is preserved as it was. New answers, comments, and votes are closed.