Issue with filtering string

Hello so I am trying to filter some text/string which comes through from a player to get announced to everyone else in the server. When I tried to do this It will not filter and just prints out the unfilterd text. Not sure if I am doing it correct as I have not used the filter before. (I don’t get any errors it just prints off the unfilterd text)

local HostShoutEvent = game.ReplicatedStorage.HostStuff.HostShout
local TextService = game:GetService("TextService")

HostShoutEvent.OnServerEvent:Connect(function(plr, ShoutSubmited)
	local filteredTextResult = ""
	local success, errorMessage = pcall(function()
		local filteredMessage = TextService:FilterStringAsync(ShoutSubmited, plr.UserId)
		mainfiltertext = filteredMessage:GetNonChatStringForBroadcastAsync()
	end)

	if success then
		print(mainfiltertext)
	else
		print("Unknow error!")
		warn(errorMessage)
	end
end)
1 Like

You cannot filter text in studio; you must go into an actual game to do this.

1 Like

Ah I see I did not know that. Thanks it works in-game.