Attempt to concatenate string with Instance

Hey there! I am making Simple Antivirus for my game, but then i run it, it says this:

ServerScriptService.Antivirus:8: attempt to concatenate string with Instance

Script:

local scriptsFound = 0
local objectScanned = 0

for i, object in pairs(workspace:GetDescendants()) do
	objectScanned += 1
	if object:IsA("Script") or object:IsA("LocalScript") or object:IsA("ModuleScript") then
		scriptsFound += 1
		print("Found Script: "..object.Name.."; Parent: "..object.Parent)
	end
end

print(objectScanned.." Objects Scanned;".." Scripts Found: "..#scriptsFound)

this line should be object.Parent.Name

1 Like

Please use string formatting + object.parent is a direct reference to the parent (object.parent.name instead of object.parent).

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