In my code, there's a function. In that, there's an if statement that sees if the object is a script. When it sees something other than a script, it calls it a script, which continues with the script and causes an error. Can anyone fix this? Thanks in advance!
I used "IsA" already and "ClassName" string. They both didn't work. The code below is all I'll provide
local function Scan(a)
if a.ClassName == "Script" or "LocalScript" then -- problem
EDIT: I just figured it out myself. If you're experiencing this problem, here is the code:
local function Random(a)
local success,data = pcall(function()
if a.Source then
Scan(a)
end
end)
end
local function Scan(a)
--Here you can proceed the code. Of course you can use the pcall here

6 comments
Can you provide the code you're explaining? It will help us understand the problem better.
I don't think you can edit the class of an object
That's now what I'm saying. The code will make you understand it better now.
Used a for i, v in pairs loop
Use*
And you can't just say "LocalScript", you have to say a.ClassName == "LocalScript" then