How do I filter the chat

Hello,

I am using iChatX and I think that this would be great for my game. But, it does not filter chat messages. Is there a way I can make it filter the chat messages that go through?


rbxassetid://2425698250

I think you can use TextService, hold on let me check.
Edit: Yes, you can its like TextService:FilterAsync()

1 Like

Yes you can:

1 Like

Use FilterStringAsync Function from textservuce as everyone above said ^

This will return the text filtered.
Also you must have a filter in most of any text cases, or roblox may take actions into this to protect they community.

1 Like

How do I use it though? I am slightly confused.

How do I use it though? I am slightly confused.


Devhub is your friend.

3 Likes

Example:

local CodeToFilter = "Hello!"
local TextFiltered = game:GetService("TextService"):FilterStringAsync(CodeToFilter, UserId)
print(TextFiltered)
1 Like

Theres some incorrect code there, based on devforum it actually returns an instance, which you have to use another function on to get the actual filtered message.

1 Like

I did that code without testing it and your right.

1 Like

Where would I insert this though? Where in the explorer.

(Where in the chat model)

We cannot know what this is a open source model, reffer the creator of that model.

1 Like

Example:

local randomstuff = "yes"
local TextFiltered = game:GetService("TextService"):FilterStringAsync(randomstuff,UserId)
local Text = TextFiltered:GetChatForUserAsync(ToUserID)
2 Likes

Example would be:

local textService = game:GetService("TextService")
game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(message)
        local filtered = textService:FilterStringAsync(message, plr.UserId)
        filtered = filtered:GetChatForUserAsync(plr.UserId)
        -- do what you want with the filtered string
    end)
end)
1 Like

But I sent the asset ID in the topic post.

Where do I put the script though, do I put it as a local script?

Alright hold on, let me put this model in some random game I have so I can figure out where I can put the code.

1 Like

Where do I put the script though, do I put it as a local script? Sorry I am a noob.

My example was just an example on how to use TextService

1 Like

Why does a module that does chat not automatically filter anyway?

1 Like