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

How do I use FilterStringAsync() from the service; TextService?

Asked by 7 years ago

I'm very confused on how to use FilterStringAsync from a Service called, TextService. Here is the script, NOTE: it's in a server script!

--note; TS = game:GetService("TextService")

local other = string.sub(msg,7):upper()
local filter = TS:FilterStringAsync(other,player.UserId)
wait(0.2)
MessageEvent:FireAllClients("[WARNING]: "..filter,BrickColor.new("Crimson").Color)

For the error, it states that Line 6 has the error. The error is; attempted to index local 'filter' (a userdata value), any help?

0
What? That's not a function, nor what it even looks like what is being accomplished. hiimgoodpack 2009 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

the Chat service is the only service with filter methods, it can be used for any text not only chat messages.

Chat = game:GetService("Chat")

local other = msg:upper():sub(7)
local filtered = Chat:FilterStringForBroadcast(other,player)
MessageEvent:FireAllClients("[WARNING]: " .. filter,BrickColor.new("Crimson").Color)
0
Oh thanks! I forgot to do that... CounterBoy123 53 — 7y
Ad

Answer this question