How would the comparison of two different positions for an anti-cheat work?

Currently I’m finishing the barebones of my game, and I’m getting to the difficult part for me at least
Anti-Cheats.

Currently I’m working on the first one, which is client-prediction running (although they aren’t really similar at all in concept)

Basically, I have two tables and for each character a table storing their location. Now what I am unsure of is wat should be compared once I set it up like this -

["Sprinting"] = function(Params)
		
		RunService.Heartbeat:Connect(function()
			Prev.PlayerLocation = Params.Player.Character.HumanoidRootPart.Position
			
			task.delay(2.5,function()
				
				Curr.CurrentLocation = Params.Player.Character.HumanoidRootPart.Position
				
			end)
		end)
		
		coroutine.wrap(function()
			for _, plr in pairs(game.Players:GetChildren()) do
				VFX:FireClient(plr, Params.Hold, "CombatVFX", "RunVFX", Params.Player.Character.HumanoidRootPart)
				
			end
		end)()
		
		
	end,

Between the two values, I don’t know if I should be comparing the values as a whole, or a specific part of them. Alongside with this, I’m not even sure if in concept this would properly work. Any assistance?

1 Like

This doesn’t make any sense. Additionally, don’t waste any time making an anti cheat for a game thats presumably, if its barebones, not even playable yet.

you should compare their old x and z position to their new x and z position from like a second ago and if its like 30 studs and the players speed is 16 studs a second then probably they are cheating ALSO the reason we dont compare the y value is because if u jump of a cliffff ur y value will change a lot
so what u wanna do is make a local OldPosition = vector2.new(player.x,player.y) and then another one local New Position = NewPosition = vector2.new(player.x,player.y) then u wanna do
(NewPosition - OldPosition).Magnitude and if that value is greater than 16 “then they are cheating” sometimes theres error though so u wanna give a bit of leeway and make it like 20 or sumn

1 Like

Barebones to me means playable? Also you need to further what you mean by this

So I can improve on the wording or whatnot.

1 Like

dont worry about that guy he shouldnt have said what he said

2 Likes