Hello! Today I’m trying to make a system that has the scope to check if a localscript inside the game gets destroyed and if yes clone it and put it back
for i, v in pairs(game:GetDescendants()) do
if v:IsA("LocalScript") then
end
end
if v:IsA(“LocalScript”) then
At this line I get this error: The current identity (2) cannot Class security check (lacking permission 6)
Is there a way to do this or it is reserved just to roblox?
Basically I was creating an anti dex system, like when exploiters delete a localscript which has the function of an antiexploit
I would recommend only checking places where local scripts operate. Checking the whole game is unneeded. The error you are getting is telling you that you are checking something that you don’t have access to.
Some descendants of the game are unable to read/check because they’re locked for use by Roblox only, meaning nothing else is allowed to access them, hence the error
For what you are doing, I’m not sure, maybe you can do a pcall as the post by @SOTR654 suggested so it only goes through accessable services for checking if a localscript gets destroyed?
local descendants = game:GetDescendants()
while true do
for i = 1, #descendants do
local success, errormessage = pcall(function()
return descendants[i]
end)
if success then -- Proceed with scanning service
if descendants[i]:IsA("LocalScript") then
print("Localscript")
end
else
warn(errormessage)
end
end
wait(1)
end
Since my game has a lot of LocalScript I should add this check to every LocalScript, I may forget one of them and that could be a problem, I would also use this for every LocalScript inside the game and not just the ones which are anti exploit components.
Because as you may know everything that isn’t on the server side can be manipulated by exploiters and i want to do this so it checks everything inside the game and if something gets destroyed it will ripristinate it.
They can easily disable / remove your script as they have access to everything on their computer.
All you’re causing is lag for other players if anything.
Uhm really i don’t know if the exploits edits only the client, i’m not interested if they broke the client, i’m interested just to prevent things that can happen for every player.
Elaborate, I don’t understand what you mean by “things that can happen for every player”.
Exploiters do not have access to the server or any server-sided scripts.
What you might refer to is an issue called client-server replication, such as their character’s position.
I will try to be clear. I want a script that checks if an exploiter with a dex destroy script inside of other player in the Players section or if they modify others’ gui ecc, it is based on ChildRemoved so if something gets removed it will remake it
for i, v in pairs(game:GetDescendants()) do
local success, result = pcall(function()
return v and v:IsA('LocalScript')
end)
if success and result then
--[[ insert code here ]]
end
end
Also I’m guessing that your making an anti exploit system, if you are this would probably not work since the exploiter’s changes only replicate to the client’s screen.
They can do that, yes. However the majority of exploiters doesn’t have a clue on what they’re doing.
You can implement a client-sided anticheat, but it won’t protect your game against the ones who know what they’re doing.