I've been making a really quick and basic scan script for my game, just to make sure there are no viruses. I am not sure why it returns this error? This is the script (Server):

function Scan(object)
	for i = 1,#tostring(object) do
	inside = #tostring(object[i]):GetChildren(print(object)) > 0 -- Problem line
			if Malicious(object[i]) then
				local oldparentvalue = Instance.new("ObjectValue")
				oldparentvalue:Clone(object)
				oldparentvalue.Name = "OriginalParent"
				item = item+1
				virus = virus+1
				percentage.Parent.Object.Text = "Current Object:"..object.Name
				Name(object[i])
				Quarantine(object[i])
				updateCount()
			else
				if #tostring(inside) > 0 then
					Scan(inside)
				end
			end
		end
	end 
	

2 comments

0

A nil value literally means whatever you might be looking for doesn’t exist.

0

So how do I check if it exists or not?