A lot of resources, especially in Resources/Community Resource, are scamming you on anti-cheat related resource. These resources usually require you to put some script into StarterPlayerScript and I guess, hopefully it work. This resource focus on how to detect those post as a scam that do nothing except for slowing down your player’s client.
Before Started, Remember:
- Ignore any buzzwords by the author
- Don’t trust any images by the author
- Avoid putting scripts into your server. If it requires, always check it out yourself to avoid backdoor
Case Study
-- <RANDOM STARTING COMMENT STRIPED>
-- [Start of Codes]
if game:GetService("RunService"):IsStudio() then
return
end
-- ratio stats:
-- avg 12.5, avg range 11.5-13.5, 98% ~17.5
-- awp averages about 31, so the difference is more than enough
-- we use a ratio so that slow pcs arent punished for being slow,
-- instead comparing execution time between a base test and getfenv
-- GETIMPORT gets slower after running getfenv, so this matters a lot
local getfenv = getfenv
local tick = tick
local violations = 0
while task.wait(0.2) do
local t1 = tick()
for i = 1, 1e4 do
getfenv()
end
local t2 = tick()
for i = 1, 1e4 do
-- do nothing lol
end
local t3 = tick()
local ratio = (t2-t1)/(t3-t2)
if ratio > 25 then
-- dont punish lag spikes, require 8 fails in a row
violations = violations + 1
if violations >= 8 then
-- insert funny code here (while true do end, etc. etc.)
warn("awp detected with decent confidence (r8: "..ratio.."), killing detection loop")
break
end
else
violations = 0
end
end
Analysis:
-- ratio stats:
-- avg 12.5, avg range 11.5-13.5, 98% ~17.5
-- awp averages about 31, so the difference is more than enough
-- we use a ratio so that slow pcs arent punished for being slow,
-- instead comparing execution time between a base test and getfenv
Ignore the buzzwords, we don’t even know what you talking about when the code start with this random comments that let us think your so cool.
-- GETIMPORT gets slower after running getfenv, so this matters a lot
local getfenv = getfenv
local tick = tick
Unnecessary, but you called getfenv() so that is why, it stop optimization from the script, but the code causes all these
Code with analysis commented
local violations = 0
while task.wait(0.2) do
local t1 = tick()
for i = 1, 1e4 do -- 1e4 is 10,000, this keep doing getfenv() 10,000 times
getfenv() -- spamming getfenv() without doing anything, this do absolutely nothing but lag your game
end
local t2 = tick()
for i = 1, 1e4 do -- 1e4 is 10,000, this loop an empty block 10,000 times
-- literally do nothing
end
local t3 = tick()
local ratio = (t2-t1)/(t3-t2) -- How you get this formula?
if ratio > 25 then
-- "dont punish lag spikes, require 8 fails in a row", you are lagging the client, dude, you are the reason why
violations = violations + 1
if violations >= 8 then
-- "insert funny code here (while true do end, etc. etc.)", summary: classic timing detection
warn("awp detected with decent confidence (r8: "..ratio.."), killing detection loop") -- what can I say?
break
end
else
violations = 0
end
end
Key Takeaway of This Scam
getfenv()disable optimization of the script, make it even easier for false positive, as documented in rfcs.luau.orggetfenv()is a heavy operation, spamming it 10,000 times lag your game, as documented in rfcs.luau.org- do nothing for 10,000 times
- unknown/random timing formula to detect hack (timing detection most likely lead to false positive on low-ended devices)
TL; DR of this case
Spamming heavy operations to lag your game and introduce timing/game speed detection for false positive on low-ended devices
Summary of This Tutorial
- Always analyze anti-cheat script before applying
- Ignore buzzwords
- Ignore false statement claimed by the author
- Skip if you see any sort of timing detection, it is a scam
- Never trust the author’s claim, verify the claim yourself
- Client-Sided anti-cheat cannot stop advanced cheats, exploiters can just disable the script on the client