How can I make an Anti-Aimlock or Anti-Aimbot

Hello, So I have been trying to make an anti-aimlock for my game. I really need an aimlock detection and a aimbot detection, Aimlock detection would be cam detection I think also aimbot detection would be remote detection

1 Like

Could you share your gunā€™s script please?

There isnā€™t a reliable way to detect aimbot without getting a lot of false positives, and even then thereā€™s silent aim and exploits that smoothly move the crosshair.

ā€œAimbotā€ and ā€œaimlockā€ mean basically the same thing in hackusation terminology, an exploit that aims for you. It has nothing to do with remote events unless itā€™s a game-specific vulnerability you are actually experiencing.

try adding ā€˜fake bodiesā€™ around the map; make them incredibly hidden; then write a script thatā€™ll kick/ban anyone who damages it.

1 Like

Something ive done, which is only effective to people who are using hacks to shoot through walls is to do the following:

  1. Client does the first Raycast
  2. Server Gets raycast information, and verifies it by:
    (1.) Creating a new part with the same size, orientation and position as the part that got hit from the clients ray.
    (2.) Make the raycast Whitelist include the Map and the created part.
    (3.) Doing another raycast to verify that the ray didnt go through any part of the map.
  3. If the shot isnt verified, and isnt possible (it went through the map or something) the player gets kicked or added to a list where they cant damage anyone.

As for an Anti-Aimbot, its nearly impossible to do, as its very hard for a script to see if someone hasnt touched grass in months, or are a hacker.

1 Like

That isnt the best solution, as hackers could easily loop through the players, and then only target a players character.

That seems like a far more complicated version of just raycasting on the server and having the server tell the client whether a shot hit.

The best way to handle hit registration is by tracking the hitboxes of players every frame in a 1-second or more long record, rolling back to the point in time where the player shot their gun by the playerā€™s ping and then checking collisions. The client can do itā€™s own stuff to be more responsive, but the above approach will make it impossible for exploiters to kill people through walls etc without harming the experience of players without good internet connections.

An issue i have when it comes to having only server-sided raycasting is lag.
As i am Australian, i usually have around 170 ping even on the closest roblox servers to me.
The only reason i do both client and server raycasting is because lag, and no one likes lag (plus my game wouldnt be nearly as fun is there was lag)

Plus im stupid.

The solution you gave would be no different than 100% serversided, the part could have moved during the time it took for the client to tell the server it wants to shoot a bullet.

And, hey, I have no idea how Roblox handles replication of RaycastResult, so itā€™s completely possible an exploiter can pass baloney through the remote, give a fake instance or something omnipresent like the map itself, and always verify.

For the specific code i used, the server inserts the map into the Whitelist table, the client doesnt send the map instance over.
However, hackers can modify the Vector values they send over, entirely bypassing my whole system, but theres unfortunately nearly nothing i can do about that.

Incorrect, my solution gets all the parts information through the client, right after the raycast is done, and sends the information to the server, which the server than replicates the part and verifies the shot, therefore the part could not have moved at all during the time the clients information took to get to the server, as the client is sending the parts information over, instead of the server getting the parts information when it recieves the event.

Specifically, in my scripts, the server only verifies the shots, and deals the damage.
No one has complained about the system, and i actually have gotten praise for it, as some people said it was better than Arsenals or Phantom Forces hit registration system (Most likely because my game isnt playable on mobile, and doesnt have oversized mobile hitboxes, cough cough ARSENAL.)

However, even if i did change the raycasting to be only server-sided, hackers would still be able to cheat just as easy, as you would need to send a RayOrigin and a RayDirection, and the RayOrigin in my game is the Cameras Position, as it is first-person.

I did make a game once where the raycasting was server-sided, and it was terrible.
It was a mix of the raycasting being bad and laggy, and poor programming on my part.

You donā€™t need to. You can send the Y and Z rotation of the camera and the server can find the camera position by doing some math with the HumanoidrootPart. I found the specific formula some time ago, I can share it if you really want.

I donā€™t know why you said that someone needs to.

But then whatā€™s the point? You arenā€™t solving anything. Itā€™s like obfuscating variable names, exploiters canā€™t see them in the first place so itā€™s useless.

Itā€™s like making the client ask the server to add two numbers together and send the result back to the client, as though thatā€™s any more secure than simply doing the math on the client itself and reducing overall input lag. Itā€™s like double-checking that the client thinks 2 + 2 is 4.

Thatā€™s only on mobile as far as I am aware, but thatā€™s a completely legitimate advantage to balance out the major disadvantage of simply playing on mobile that only tryhards that grind 30 hours a day will care about.

Interesting.


Anyway, Iā€™m not going to continue arguing. I learned a lot about this networking time travel through the following article written by Valve, developers of Team Fortress 2 and Counter Strike: Global Offensive;

https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking#Lag_compensation

I know this is a very bad code of a gun but well it checks for your mouse value also
the value changes everytime you equip the gun

Tool = script.Parent
Player = script.Parent.Parent.Parent

local db = false
script.Parent.Activated:Connect(function()
	
	local Mouse = script.Parent.Parent.MousePos.Value
	print(Mouse)
	if db == false then
		db = true
	if Tool.Ammo.Value >= 1 then

		local GUI = Player.PlayerGui:WaitForChild("Weapons").Revolver

		local GoingToShootBullet = GUI.MainFrame:FindFirstChild("BulletImage")



		if GoingToShootBullet then
			
			GoingToShootBullet.ImageTransparency = 0.6
			GoingToShootBullet.Name = "UsedBullet"

			if Player.Character:WaitForChild("Reload").Value == false then
				Player.Character:WaitForChild("Reload").Value = true
				Tool.Barrel.ShootUI.Shoot.Visible = true
				Tool.Handle.ShootLight.Enabled = true
				Tool.Barrel.ShootUI.Shoot.ImageTransparency = 0.6

				local Shoot = Instance.new("Sound")
				Shoot.Parent = Tool.Handle
				Shoot.SoundId = "rbxassetid://1583819337"
				Shoot:Play()

				local rayDirection = Mouse
				local rayDesti = rayDirection - Tool.Handle.Position

				
				local ray = Ray.new(Tool.Barrel.CFrame.p, (Mouse - Tool.Barrel.CFrame.p).unit*50)


					
		
				local EndPoint = Instance.new("Part")
				local StartPoint = Instance.new("Part")

				EndPoint.Transparency = 1
				EndPoint.Parent = game.Workspace
				
				EndPoint.Size = Vector3.new(1, 1, 1)
				EndPoint.Anchored = true
				EndPoint.CanCollide = false
				EndPoint.Name = "Bullet"

				StartPoint.Transparency = 1
				StartPoint.Parent = game.Workspace
				StartPoint.Position = Tool.Barrel.Position
				StartPoint.Size = Vector3.new(1.5, 1.5, 1.5)
				StartPoint.Anchored = true
				StartPoint.CanCollide = false
				StartPoint.Name = "Bullet"

				local Beam = Instance.new("Beam")
				local Attachment_0 = Instance.new("Attachment")
				local Attachment_1 = Instance.new("Attachment")

				Beam.Parent = StartPoint
				Attachment_0.Parent = StartPoint
				Attachment_1.Parent = EndPoint
				Beam.LightEmission = 1
				Beam.Attachment1 = Attachment_1
				Beam.Attachment0 = Attachment_0
				Beam.Width0 = 0.002
				Beam.Width1 = 0.09
				Beam.FaceCamera = true
				local Ignore = {script.Parent.Parent, workspace.Bullet}
	           local Part, Position = workspace:FindPartOnRayWithIgnoreList(ray, Ignore)
				local distance = (Position - Tool.Barrel.CFrame.p).magnitude
				EndPoint.CFrame = CFrame.new(Position, Tool.Barrel.CFrame.p)
				--EndPoint.Position = Mouse
					local humanoid = Part and Part.Parent and Part.Parent:FindFirstChild("Humanoid")
					print(Part)
				
						local function DoDamage(amount, humanoid)
							humanoid.Health = math.clamp(humanoid.Health - amount, 0.2, humanoid.MaxHealth)
						end
					print(Part)
				

if Part then
							if Part.Parent:FindFirstChild("UpperTorso") or Part.Parent:FindFirstChild("Head") or Part.Parent:FindFirstChild("RightUpperLeg") or Part.Parent:FindFirstChild("LeftUpperLeg")  then
							--if humanoid and humanoid.Parent:FindFirstChild("ShootValue").Value == true then
							if Part.Parent:FindFirstChild("Price") then
								--holi
							elseif game.Players[Part.Parent.Name].CrewID.Value > 0 and game.Players[Part.Parent.Name].CrewID.Value ~= Player.CrewID.Value then
								local Kill = Instance.new("Sound")
								Kill.Parent = Part.Parent
								Kill.SoundId = "rbxassetid://10148075586"
								Kill:Play()
								DoDamage(28,humanoid)
 
								game.Debris:AddItem(Kill,0.7)

else
								if game.Players[Part.Parent.Name].CrewID.Value == 0 then
									DoDamage(28, humanoid)
									local Kill = Instance.new("Sound")
									Kill.Parent = Part.Parent
									Kill.SoundId = "rbxassetid://10148075586"
									Kill:Play()
									
									game.Debris:AddItem(Kill,0.7)
								end
					      
							end
						
							
						
					elseif  Part.Parent:IsA("Accessory") then
						if game.Players[Part.Parent.Parent.Name].CrewID.Value > 0 and game.Players[Part.Parent.Parent.Name].CrewID.Value ~= Player.CrewID.Value then
						DoDamage(28,Part.Parent.Parent:FindFirstChild("Humanoid"))
						else
							if game.Players[Part.Parent.Parent.Name].CrewID.Value == 0 then
								DoDamage(28, Part.Parent.Parent:FindFirstChild("Humanoid"))
									local Kill = Instance.new("Sound")
									Kill.Parent = Part.Parent
									Kill.SoundId = "rbxassetid://10148075586"
									Kill:Play()
									game.Debris:AddItem(Kill,0.7)
							end
						end
	
-----q
					else
						
						if Part ~= nil and Part.Parent:FindFirstChild("Open") then
								DoDamage(28, humanoid)
						elseif Part ~= nil and Part.Parent:FindFirstChild("Price") then
							--a
                         --oliiii!
							end
						
						
						end
					end
					
                game.ReplicatedStorage.MainEvent:FireClient(Player) -- This is a recoil
                
					Player.Character.Humanoid.WalkSpeed = 7
					
				Tool.Barrel.ShootUI.Shoot.Visible = false
				Player.Character:WaitForChild("Reload").Value = false
				Tool.Handle.ShootLight.Enabled = false
				game.Debris:AddItem(Attachment_0,0.2)
				game.Debris:AddItem(Beam,0.2)
				game.Debris:AddItem(Attachment_1,0.2)
				game.Debris:AddItem(EndPoint,0.2)
				game.Debris:AddItem(StartPoint,0.2)
					game.Debris:AddItem(Shoot,1)
					



			end
		else
			Tool.Handle.NoAmmo:Play()
		end
		
		end
		wait(0.2)
		Player.Character.Humanoid.WalkSpeed = 22
		db = false
end

end)

I already have the idea but I donā€™t know how exactly can I make it

The only idea i have is calculate the camera movement speed and see if where it points there is a head, check if the speed is too high but it would probably cause false posivites

This script looks like fromo da hood guns

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.