I have this code to prevent exploiters. Do you think it would work?
game.Players.PlayerAdded:Connect(function(player)
while true do
wait(5)
if game:GetService("Stats"):GetTotalMemoryUsageMb() > 1000 then
print("Suspicious activity detected!",player.Name)
player:kick("Suspicious activity detected!")
end
end
end)
Noo… This won’t check for the individual player, I believe it just gets the server’s RAM usage, which will probably be more than 1GB.
Generally, RAM usage differs from client to client, and it’s hard to reliably detect exploits with it. However, when injecting, your RAM will spike with a few hundred megabytes, which is something you could pick up on. RAM spikes doesn’t necessarily mean an exploit was injected however, and could just be something else.
The script is on the client? Then why are you using Players.PlayerAdded?
Either way, detecting exploits from RAM spikes is very difficult. You can’t just write a set value and kick the player if their RAM usage exceeds it. Sometimes, the pc uses more RAM, sometimes less. If you want to detect it, you would have to make a sophisticated anti cheat which saves the standard for each player, and detects abnormalities. Even that isn’t perfect, and could give out false positives.
Overall, it’s really complicated, and probably not worth the effort.