So a lot of people tend to get stuck wondering how in the world they will be able to protect a LocalScript. I thought I'd try to help anyone in need of an answer to this. One way you can do this is by having two LocalScripts.
So, there's LocalScript1, and LocalScript2. Lets say LocalScript1 has the anti-exploit code in it. We will use LocalScript2 to detect if LocalScript1(anti-exploit) is deleted. In LocalScript1 we will do the same thing, the only difference is that it will detect is LocalScipt2 is deleted. Doing this will keep them both protected by repeatedly checking each other with a loop. In this case we will just use a while loop.
Code Example: LocalScript1
--Anti-Exploit before the while loop. while wait() do --Make sure this while loop is at the end of your script! if LocalScript2 == nil then --Check if the script was deleted. LocalPlayer:Kick("Tried to delete Anti-Exploit") --Kick the player if they deleted LocalScript2. else if LocalScript2.Disabled then --Check if the script is Disabled. LocalScript2.Disabled = false --Here you could Kick the player, but we will just enable it again in this example. end end end
So basically, make 2 scripts check if they are deleted and if one gets deleted the other kicks the player, and if one is disabled, the other enables it. Make sure to put them in a place where their parents wont get deleted or have the script check its parent. Hope this was helpful!
First of all, the exploiters can destroy/disable both localscripts at once. Second of all, never kick on the client, they could easily bypass that kick. If you really want to get rid of an exploiter on the client then try crashing them with something like:
while true do end
I would suggest it saying You were kicked for hacking instead of Tried to delete Anti exploit cause then they will come back with better script.
Closed as off-topic by VitroxVox, Vinceberget, AspectW, Syclya, PrismaticFruits, JesseSong, moo1210, ScuffedAI, lazycoolboy500, zblox164, EmbeddedHorror, and Utter_Incompetence
This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.
Why was this question closed?