Plugin don't have permission to get Children

hi, i was working at my Anti-Virus script, it works to delete the ‘Known’ Viruses in the workspace but it can’t delete the ‘Known’ Viruses in the Replicated Storage, the error:

11:26:29.316 - The current identity (5) cannot Class security check (lacking permission 6)

the part where the errors happen:



Button.Click:Connect(function()
	WPS:SetWaypoint('Removed all Viruses')
	for _,Children in ipairs(workspace:GetChildren()) do
	    D(Children)
	end
	delay(1,function()
	for _,Children in ipairs(game.ReplicatedStorage:GetChildren()) do
	    D(Children)
	end
	end)
end)

i think its becouse u can’t use plugins on ReplicatedStorage

Have you tried debugging to check which line exactly the error is from? What is the D() function?

this is the D() function:



	local function D(object)
		if table.find(Virus,object.Name) then
		    Destroy(object)
		    RemovedVirus[1] = RemovedVirus + 1
		elseif not table.find(Virus,object.Name) and #object:GetChildren() > 0 then
		for _,Object in ipairs(object:GetChildren()) do
			D(Object)
		end
	end
end

and the error line is line 55

this is the error:


	for _,Children in ipairs(game.ReplicatedStorage:GetChildren()) do
	    D(Children)
	end

Lol i know im like 3 months late, but you need to wrap it in a pcall, because some roblox items are locked by roblox and you can’t ever acess them. putting it in a pcall will catch that error and continue running with the rest of your code.

1 Like