Code Review / Support

Hey!

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)
1 Like

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.

1 Like

It’s on the client side though. And how what should I set it to?

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.

2 Likes

Alright. And do you happen to know of a resource/model that I can use?