Im just trying to filter a String. Ive been through like 20 different threads and none of them work. Ive got a custom shout’s in-game. They type the desired message into a GUI and the GUI sends data to the server with the player and their desired message. The server then filters the message and does :FireAllClients() to have the little announcement UI show up. But its not. Somebody help, ive been at it for like 2 hours now.
Try using TextService:FilterStringAsync(), keep in mind that it must be called by the server.
local myString = 'some text'
local recipient = 123456 -- recipient's user ID, must be connected to server
local recipientType = 'PublicChat' -- can be PublicChat or PrivateChat
local filteredObject = game:GetService('TextService'):FilterStringAsync(myString, recipient, recipientType)
local filteredText = filteredObject:GetNonChatStringForBroadcastAsync() -- the actual string
Have you tried using the FilterStringForBroadcast method of the Chat service? It takes the text to filter, and the speaker who said the text.
local Speaker = game.Players.Player;
local Text = "Hello World! How are you?";
local FilteredText = game.Chat:FilterStringForBroadcast(Text, Speaker);
print(FilteredText); -- Filtered text outputted