How to make Anti Fly Exploit?

Hello! i want to do Flying Exploit detection for my game but i don’t know how can i do this, i never tried to do a Anti Fly Exploit. Can somebody help me?

5 Likes

Roblox made it so FloorMaterial doesnt replicate from the client to the server anymore so you can just check if the FloorMaterial is air for way too long.

4 Likes

But maybe Anti Exploit can detects when player is FreeFalling? also how can i do this?

2 Likes

Just make a time limit and if the player is in the air for over that time limit then they’ll be punished.

2 Likes

Just make a loop that runs when the player’s floor material is air and make it add 0.1 seconds to a counter and reset the counter when they’re not in the air and just check if the time limit is exceeded.

2 Likes

I’ll try that but what if player lagging?

2 Likes

Players can just teleport themselves back onto the ground at a random place, so this wouldnt help.
There’s this post:

that may help with what you’re trying to achieve.

2 Likes

What if players got fling? This script detecting players if they get fling.

1 Like

Just make it so the anticheat is very passive and just teleports the player back to the floor.

1 Like

You can just check if the floor material keeps changing from air to another part too fast and way too much to deal with that.

1 Like

in some cases hackers may use body movers to move their characters, watch for those in characters.

1 Like

Ah yes create a client sided anticheat!!! which they can just hook and make it return end or nil!!!

1 Like

Ideally, you want any kind of AntiCheat system to be server side only. Do your detections there. If you put your AntiCheat on the client, you are essentially trusting the client to turn themselves in.

1 Like

i did that but it’s always teleporting the players, when got fling while ragdolled or not

1 Like

then check the amount of seconds they’re in the air and if they’re in the air for over a second then teleport them.

1 Like

Jumping with the NORMAL Roblox jump height takes a little more than a second…

1 Like
local character_cache = {}

game["Run Service"].Heartbeat:Connect(function()
	local currentTime = os.clock()
	local maxTimeInAir = 3 -- insert the duration here
	
	for player : Player, cache in pairs(character_cache) do
		if currentTime - cache[3] >= maxTimeInAir then
			local human : Humanoid =  cache[4]
			if not table.find({Enum.HumanoidStateType.FallingDown,Enum.HumanoidStateType.Freefall},human:GetState()) then
				-- PLAYER IS PROBABLY EXPLOITING
			else
				character_cache[player][3] = currentTime 
			end
		end
	end
end)

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAppearanceLoaded:Connect(function(character)
		local humanoid = character:FindFirstChildWhichIsA("Humanoid")
		humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
			if humanoid.FloorMaterial == Enum.Material.Air then
				character_cache[plr] = {character, humanoid.FloorMaterial, os.clock(), humanoid}
			else
				character_cache[plr] = nil
			end
		end)
		character.Destroying:Connect(function()
			character_cache[plr] = nil
		end)
	end)
end)

edit: haven’t actually tested this but in theory it should work

1 Like

Try using game:GetService("RunService") instead, for cleaner (and maybe safer too) code.

No real performance difference between game[service] and game:GetService(“Service”)

server sided of course, that would be dumb. who said to use local scripts