How would I make an aimbot anti-exploit?

Hey! I’m working on a shooter game and I made a simple aimbot script and I was wondering if there is a way to make an anti-exploit for this.
Script:

local aimonthispart = workspace.cammy 
game:GetService('RunService').RenderStepped:Connect(function()
	local t = aimonthispart.CFrame * Vector3.new(0, -0.25, 0);
	local cam = workspace.CurrentCamera 
	cam.CFrame = CFrame.new(cam.Focus.p, t) * CFrame.new(0, 0, 0.5); 
end)

Any help would be very appreciated!

3 Likes

You don’t because you can’t. You can’t even stop it’s execution on the client either. Even if you could, you shouldn’t do that. Exploiters can bypass that.

2 Likes

Make sure there are more variables to your game than just “shot hits right on target”. There should be some kind of fire spread on the server, recoil, fire rate enforcement etc. These don’t stop aimbots but they make their effectiveness diminish a bit.

8 Likes

How would you implement recoil on the server? It should just be camera manipulation, I don’t see how you could handle that on the server at all.

1 Like

The camera could be offset upwards without actually being moved, and the server would handle also “shooting” the bullets higher, as an example.

I get that the server would be firing the bullets, but I don’t get how you would offset the camera or anything like that on the server. When you say “the server would handle also shooting the bullets higher,” do you mean that you’d offset the client’s shot based on how much recoil should have affected them? I don’t get what you’re saying.

The server is authorizing the shot to go through, so if you know how much recoil your player should be experiencing then you can have your checks also be offset by this on the server.

Why? If the player’s camera is being tilted upwards, the player is going to try to fight the recoil. Adding artificial recoil on the server is just going to make it twice as high if they don’t work against it, or they’ll be frustrated that nothing’s lining up when they do try to fight it.

That’s implementation specific and I can’t give a one size fits all answer. You can implement the specifics on your own game within the environment you’ve established there.

I don’t think handling the recoil on the server works in any game. If the recoil is handled by the server, trying to fight against it will either have slow response time for the user or not work at all. It sounds like a pretty horrible user experience when they can’t tell how much their gun is recoiling and just know it’s being offset somewhere outside their control.