function methods.InternalApplyRobloxFilter(z,n,R,Y)if RunService:IsServer()and not RunService:IsStudio()then local d=z:GetSpeaker(n)local l=Y and z:GetSpeaker(Y)if d==nil then return nil end local r=d:GetPlayer()local y=l and l:GetPlayer()if r==nil then return R end if allSpaces(R)then return R end local E=tick()local T=0 while true do local n,Y=pcall(function()if y then return Chat:FilterStringAsync(R,r,y)else return Chat:FilterStringForBroadcast(R,r)end end)if n then return Y else warn("\069\114\114\111\114 \102\105\108\116\101\114\105\110\103 \109\101\115\115\097\103\101\058",Y)end T=T+1 if T>MAX_FILTER_RETRIES or tick()-E>MAX_FILTER_DURATION then z:InternalNotifyFilterIssue()return nil end local d=FILTER_BACKOFF_INTERVALS[math.min(#FILTER_BACKOFF_INTERVALS,T)]local l=d+(math.random()*2-1)*d wait(l)end else if not StudioMessageFilteredCache[R]then StudioMessageFilteredCache[R]=true wait()end return R end return nil end

function methods:InternalApplyRobloxFilter(speakerName, message, toSpeakerName) --// USES FFLAG
	if (RunService:IsServer() and not RunService:IsStudio()) then
		local fromSpeaker = self:GetSpeaker(speakerName)
		local toSpeaker = toSpeakerName and self:GetSpeaker(toSpeakerName)

		if fromSpeaker == nil then
			return nil
		end

		local fromPlayerObj = fromSpeaker:GetPlayer()
		local toPlayerObj = toSpeaker and toSpeaker:GetPlayer()

		if fromPlayerObj == nil then
			return message
		end

		if allSpaces(message) then
			return message
		end

		local filterStartTime = tick()
		local filterRetries = 0
		while true do
			local success, message = pcall(function()
				if toPlayerObj then
					return Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj)
				else
					return Chat:FilterStringForBroadcast(message, fromPlayerObj)
				end
			end)
			if success then
				return message
			else
				warn("Error filtering message:", message)
			end
			filterRetries = filterRetries + 1
			if filterRetries > MAX_FILTER_RETRIES or (tick() - filterStartTime) > MAX_FILTER_DURATION then
				self:InternalNotifyFilterIssue()
				return nil
			end
			local backoffInterval = FILTER_BACKOFF_INTERVALS[math.min(#FILTER_BACKOFF_INTERVALS, filterRetries)]
			-- backoffWait = backoffInterval +/- (0 -> backoffInterval)
			local backoffWait = backoffInterval + ((math.random()*2 - 1) * backoffInterval)
			wait(backoffWait)
		end
	else
		--// Simulate filtering latency.
		--// There is only latency the first time the message is filtered, all following calls will be instant.
		if not StudioMessageFilteredCache[message] then
			StudioMessageFilteredCache[message] = true
			wait()
		end
		return message
	end

	return nil
end
