HELP Custom Chat with Filtering

So as you can see I add the InvokeServer but i got an error :

17:34:35.308 FilterMessage is not a valid member of ReplicatedStorage "ReplicatedStorage" - Client - LocalScript:9

You need to insert a remote event in replicatedstorage and call it FilterMessage. I fixed the code now using a remote event.

1 Like

im lost haha xd what did i do xd in order ( im sorry )

Remove the variable result and remove the print because now it will return nothing.

And in the onclientevent the first parameter is the player and the second parameter is the message

And in the clone.plr.Text put:

clone.plr.Text = "[" .. plrThatSent.Name .. "]: " .. message

Also remember that the script must be in the serverscriptservice

No, please use this tutorial instead @Moldard :

1 Like

it looks difficult but okay i will try thx !

This is better as it uses an asynchronous thread. ChatService does not meaning that you’d have to make your own function to wait until it finished running the filter.

1 Like


I try this but obviously it doesnt work … x)

Your never calling getTextObject or getFilteredMessage also :GetChatForUserAsync requires it to be sent to one individual user, use Broadcast if your going to do it for the full server.

1 Like

woah :o you lost me xd too difficult for me i think xd

If you want to use :FireAllClients() you’ll need to use: TextFilterResult | Roblox Creator Documentation

1 Like

ok but i use it where ? im lost haha

Here is a tutorial on text filtering: A Guide to Filtering Text

1 Like

ok so i follow all the guide and i think im ok but it still doesnt work :
the local script


and the server script

This is the problem:

Remove

Replace this with:

Event.OnServerEvent:Connect(onSendMessage)
1 Like

image

i got this error … :confused:

Replace this (Line 34 of main script):

Replace

Event:FireClient(player, filteredMessage)
1 Like

Also, add this to the start of the chat gui:

script:FindFirstAncestorOfClass("ScreenGui").Enabled = false
script:FindFirstAncestorOfClass("ScreenGui").Enabled = game:GetService("Chat"):CanUserChatAsync(game.Players.LocalPlayer.UserId)

This is required by Roblox as it respects parental controls.

1 Like

Sorry, you should replace this with (again another Roblox requirement):

if game:GetService("Chat"):CanUsersChatAsync(sender.UserId, player.UserId) then
Event:FireClient(player, filteredMessage)
end

This is so blocked players cannot chat with each other, Roblox prohibits blocked users chatting to each other…

1 Like

OKAY ! ITS WORK ! Thank you a lot man <3

1 Like