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

How do I get a message filtered in a GUI?

Alright, so I've made a warning system, scripted it myself (copying = bad).

Anyways, I'd like to make it so the string is filtered, right now I get this result.

Here is a snippet of my code, I've tried to include FilterStringAsync() but got no where.

local WarnReason = Message:split(TargetUser)[2] -- !warn User **Reason**

WarningGuiClone.WarningNum.Value = WarningGuiClone.WarningNum.Value + 1 

WarningGuiClone.WarnLabel.Text = ("Warning "..WarningGuiClone.WarningNum.Value.." - "..WarnReason)

If you need more comment so!

Anyways thanks for the help, peace.

2 comments

0

Can you list your attempts?

0

Thank you, I've got it working

2 answers

#The client cant use TextService

TextService is non-replicated, meaning it only works in ServerScripts. We'll need to send our string to the server and back.

#How to get around this

We'll need to use RemoteFunctions.

Keep all your local code but instead trigger a RemoteFunction with the string you want to filter. Like so:

LocalScript

local RemoteFunction = -- The location of a RemoteFunction

RemoteFunction:InvokeServer(string)

Ref for InvokeServer

Now we filter it and return it.

ServerScript

local RemoteFunction = -- The location of the same RemoteFunction

RemoteFunction.OnServerInvoke = function(string)
	-- code to filter it
	return filteredString
end

Ref for OnServerInvoke

Back to the LocalScript so we can store the filtered string in a variable.

LocalScript

local RemoteFunction = -- The location of a RemoteFunction

local filteredString = RemoteFunction:InvokeServer(string)

Now you use filteredString for whatever you want to do with the filtered string.

#That should be good, hope this helps!

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