Filter text without a userID

The title kinda speaks for itself, I want to filter a string without having to provide a UserID as it’s a non-local script, is this possible? I will provide a snippet of my code for you to understand what I’m trying to achieve.

script.Parent.Parent.Events.TVEvent.Event:Connect(function(func, title, description)
		warn("attempting to initialise")
		if func == "Notification" then
			warn("test to see if works yes")
			local TextService = game:GetService("TextService")
			local provided_title = tostring(title)
			local provided_desc = tostring(description)
			local filtered_title
			local filtered_desc

			local success, errorMessage = pcall(function()
				filtered_title = TextService:FilterStringAsync(provided_title, PlayerUserID)
				filtered_desc = TextService:FilterStringAsync(provided_desc, PlayerUserID)
			end)

			if success then
				return filtered_title, filtered_desc
			end


			for _,D in pairs(Displays) do
				if not D.Screen:FindFirstChild("UI") then
					warn("Uh-oh, failed to find UI.")
				else if D.Screen:FindFirstChild("UI") then
						if title then
							print("Found Title")
							if description then
								print("description found, even better!")
								print("Title Found: "..filtered_title)
								print("Description Found: "..filtered_desc)
							else if not description then
									print("description not found, womp womp.")
								end
							end
						else if not title then
								print("you're silly, you have to provide a title!")
							end
						end
					end
				end


			end
		end
		warn("initialised successfully")
	end)

The whole printing the filtered text is purely just to test it, any ideas?

I am sure you have to display the text at one point. Why not just filter the text at that point?

1 Like

text filtering is designed to be on a per account basis

I’ve sorted it, thanks for everyones help :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.