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.
Try using FilterStringForBroadcastAsync, which only uses two arguments.
You can learn more here! https://developer.roblox.com/en-us/api-reference/function/Chat/FilterStringForBroadcast
TextService is non-replicated, meaning it only works in ServerScripts. We'll need to send our string to the server and back.
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.