I want to filter a nametag for my pets. That’s all.
It’s easily done when the player enters the name of the pet, just use
success, err = pcall(function()
local result = TextService:FilterStringAsync(name, player.UserId)
name = result:GetNonChatStringForBroadcastAsync()
end)
But I’m also encouraged by the wiki to save the unfiltered string and filter it every time the game loads.
But it doesn’t supply a single function that DOES JUST THAT!
I cant run FilterStringAsync without a userid. What am I suppose to do? Save the userid that created every single string too? Well guess what, you can’t! Because you get the error
The sender must be connected to the current server
if you store for example the unfiltered name of the pet that belongs to the player, there shouldnt be a problem with the UserId since the player is on the server?
if you need to load the player’s data when they are not in the game, you can store the filtered and unfiltered pet name in the same string, such as “Name/FilteredName”, and then use string.split(string, "/") to get the names. you can update this value every time a player rejoins, there is no other way
there is no way to filter the string without the player, they made it so that no one can use it maliciously to get someone in trouble
otherwise anyone could to get you banned / warned by doing this
TextService:FilterStringAsync("some bad words", YourUserId)
I think they only want you to re-filter it when the pet owner loads the game, not whenever any player loads the game. Unless you are displaying it someplace for other players to see when the owner isn’t playing, you shouldn’t have to worry about this. Just make sure the name is re-filtered and saved before it is displayed on the player’s pet during their visit.