You need to change your code to handle the return value correctly, use GetChatForUserAsync to retrieve the filtered string, and you should assign the filtered name to currentName and handle any potential errors appropriately, here’s how you’d go about doing that Xx
local success, filteredName = pcall(function()
return textService:FilterStringAsync(Name, plr.UserId):GetChatForUserAsync(plr.UserId)
end)
if success then
currentName = filteredName
else
warn("Failed to filter the name: " .. filteredName)
currentName = Name
end
plr:SetAttribute('RestaurantName', currentName)
So I have used your new code, but it does not seem to be filitering the string. (Btw I am also setting a textlabel to the currentName text later on in the script.) Code:
local success, filteredName = pcall(function()
return textService:FilterStringAsync(Name, plr.UserId):GetChatForUserAsync(plr.UserId)
end)
if success then
currentName = filteredName
else
warn("Failed to filter the name: " .. filteredName)
currentName = Name
end
plr:SetAttribute('RestaurantName', currentName)
I was able to find out what was causing it (I forgot to post this) so basically I did not know the text did not filter in roblox studio, so I went in game and tested it. It worked perfectly fine.