TextService Filtering Isn't Filtering Innappropriate Words

Heyo, I am trying to filter user generated names. I tried a couple of innappropriate words and they bipassed the filter from studio. Am I doing something wrong or does TextService not work in studio?

Thanks

local TextService = game:GetService('TextService')



local TextFilter = {}

local function getTextObject(message, fromPlayerId)
  local textObject
  local success, errorMessage = pcall(function()
    textObject = TextService:FilterStringAsync(message, fromPlayerId)
  end)
  if success then
    return textObject
  elseif errorMessage then
    warn("Error generating TextFilterResult:", errorMessage)
  end
  return false
end

function getFilteredMessage(textObject)
  local filteredMessage
  local success, errorMessage = pcall(function()
    filteredMessage = textObject:GetNonChatStringForBroadcastAsync()
  end)
  if success then
    return filteredMessage
  elseif errorMessage then
    warn("Error filtering message:", errorMessage)
  end
  return false
end

function TextFilter.FilterText(player, text)
  if text ~= "" then
	print('Filtering:', text)
    local messageObject = getTextObject(text, player.UserId)
    local filteredText = ""
    filteredText = getFilteredMessage(messageObject)
	print('Filtered message:', filteredText)
    return filteredText
  end
end


return TextFilter
1 Like

The filter does not work in Studio.

Consider supporting this feature request.

16 Likes