Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to filter a text in GUI element?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!

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? TinfoilbotGamer 35 — 4y
Ad

Answer this question