Anti delete script

Here is the script is it efficient can I improve it?

local RunService = game:GetService("RunService")
local Lighting = game:GetService("Lighting")
local HttpService = game:GetService("HttpService")

local BlurEffectTable = {}

RunService.Heartbeat:Connect(function()
    local BlurEffect = nil
    if not Lighting:FindFirstChildOfClass("BlurEffect") then
        BlurEffect = Instance.new("BlurEffect")
        BlurEffect.Name = HttpService:GenerateGUID()
        BlurEffect.Parent = Lighting
        table.insert(BlurEffectTable, BlurEffect.Name)
    end
    if BlurEffect ~= nil and #BlurEffectTable ~= 1 then
        if Lighting:FindFirstChildOfClass("BlurEffect").Name ~= BlurEffectTable[#BlurEffectTable - 1] then
            warn("Something Has Tampered With BlurEffect Number:", BlurEffectTable[#BlurEffectTable - 1])
        end
    end
end)
1 Like

Ok, first of all I’m not sure why you’d ever need the anti-tamper part of this script but I’ll ignore that for now.

You should be just adding the instances to the table instead of giving them unique names and adding their names in. You can compare if 2 instances are the same and you can put instances in tables so you don’t need to do that.

You can move the second if statement to inside the bottom of the first one, since there’s no point if checking if BlurEffect exists or not when you can just move that code inside the code that creates it.

Also, don’t put if statements inside of if statements that could easily be replaced by using and. If a if statement gets too long, you can just do this: (single letter variables used for demonstration, don’t actually use single letter variables)

if
	a = 1
	and b = 2
	and c = 5
then
	print(a)
end

You should also look into using more event based code (ChildAdded, ChildRemoved, etc) as this is doing checks every Heartbeat when it could be connecting to events instead.

I think you should just remove all of this code and put a BlurEffect in lighting using the explorer and set the enabled property when needed using scripting. (i’d also recommend disabling it by default in the properties window) There’s a lot of unneeded code here in my opinion.

edit just realised this is supposed to be a clientside anticheat. it’ll be easily bypassed anyway, so i still don’t think the anti-tamper part of this script should be there

3 Likes

If this is on the server, it’s not needed because changes don’t replicate to it. If it’s on the client, then it’ll be bypassed very quickly anyways. Just make sure you aren’t relying on this blur for anything major.

7 Likes

If you’re using a BlurEffect to hide certain aspects of your game, you can easily just move the model/UI to ServerStorage until it’s needed to be used.

Having a loopcheck that checks for a BlurEffect can be easily bypassed. A better way is to detect if a child of Lighting is removed, then just cloning it and replacing it back. It can trick ‘newbie’ exploiters into thinking their deleteblur script is failing.

Any exploiter with an ounce of Lua knowledge can bypass it.

1 Like