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 use FilterStringAsync() from the service; TextService?

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?

1 comment

0

What? That's not a function, nor what it even looks like what is being accomplished.

1 answer

✓ Accepted answer

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)

1 comment

0

Oh thanks! I forgot to do that...

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