Text Filtering not working

Can someone explain how I can fix this so the text gets a filter check because I am having issues with this and I am not sure why it is not working.

local filtered = game.TextService:FilterStringAsync("MAGMA", 22194708) 
print(filtered)

I keep receiving this error:

The filter turns into an Instance? and then nothing is returned so then I get a nil.

It does not return an instance, it returns a TextFilterResult. Additionally, keep in mind:

This method currently throws if fromUserId is not online on the current server. We plan to support users who are offline or on a different server in the future.

You should not be using a hard-coded UserId, instead get the LocalPlayer’s UserId like so:

local Players = game:GetService("Players")
local TextService = game:GetService("TextService")
local client = Players.LocalPlayer

local filterResult = TextService:FilterStringAsync("MAGMA", client.UserId)

Keep in mind this function can error and it’s best to wrap it in pcall (protective call).

1 Like

Filtering API doesnt work on the client.

2 Likes

Yeah, I figured but I haven’t used it in a while so I wasn’t 100% sure.