Anti fly script

Never trust the client. You shouldn’t rely on a LocalScript to do your exploit checks; an exploiter could just send fake data through. Also, with a bad connection, something like walking out of a house could get you kicked with this system (client says it’s on the floor of the house, by the time server receives it they’re out on the steps or something).

6 Likes

Not a good idea. I recommend you look for Gyros being put in the player, as this is how a player flies. And how many exploits make them fly, unless you are using gyros for some reason in your game, I highly recommend to do this.

1 Like

This wouldn’t work. Exploits create things client-side that the server can’t see and you definitely shouldn’t be patching exploits client-side. Server-side Position/Raycast checks are the way to go.

1 Like

my own and here’s what i got

local player = game.Players.LocalPlayer
local sitcount = 0
local maxsit = 2 

spawn(function() 
	while wait(1) do
		if sitcount > maxsit then
			player:Kick('Kicked for Fly Hacks')
		end
		sitcount = 0
	end
end)

player.CharacterAdded:connect(function(Character)
	Character.Humanoid.StateChanged:connect(function(oldstate, newstate)
		if newstate == Enum.HumanoidStateType.Seated then
			sitcount = sitcount + 1
		end
	end)
end)

another way put a big part in sky and if theirs no thing ur game that can make a player get that high in game then kick player if they touch part

Simple code hack

There would be a problem with that. What if a player gets flung up to the part when they aren’t flying. Also sometimes exploiters don’t even fly that high.

1 Like

I’m sure they will fly that high also,There’s a way to prevent flinging
Ragdoll system prehaps

I know that it has been an extreme amount of time since this has been posted. But I do have my own anti-exploit type of thing for flying.

Finds name only:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

character.HumanoidRootPart.ChildAdded:Connect(function(new)
	if new.Name == "BodyGyro" or new.Name == "BodyVelocity" then
		wait()
		game:GetService("Players").LocalPlayer:Kick("\nFailure to find security key")
	end
end)

Detects anything with specified ClassNames:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
character.HumanoidRootPart.ChildAdded:Connect(function(new)
	if new.ClassName == "BodyGyro" or new.ClassName== "BodyVelocity" then
		wait()
		game:GetService("Players").LocalPlayer:Kick("\nFailure to find security key")
	end
end)

Additionally, you can replace the part where it kicks with a replicated event.

4 Likes

Does anything detrimental happen to a player’s account when they get kicked from a game? im just wondering if one could use kicking as a game mechanic

If someone gets kicked from a game nothing happens to their Roblox account. It simply just removes them from the game if that is what you are asking.

1 Like
  • You could use many invisible,non colide-able parts with TouchEvent detector.
  1. Place them all arround your map and in places normal players can’t get to witouth flying.
  2. After that, if your game has no player-to-player colide, you can make a script that kicks every player that touches those parts,but also that checks if the player is not coliding them, every 3 or 5 seconds.
  3. Also add in another hidden script,or just a normal script with a strange name(So no one gets it is the anti-fly) a checker so if the player isn’t anymore sending information about is he touching or not those invisible parts, he gets kicked or banned,at your choice.

Ps: I am a beginner scripter in RobloxLua,so sorry if in my words there was something illogic.

You don’t need to rename “a normal script with a strange name(So no one gets it is the anti-fly)”. If you simply put the server Script in ServerScriptService, it will not replicate and malicious users will have no normal method to disable/manipulate it.

Having server-sided boundary checks for areas that are inaccessible to regular players is a sound idea. However, being ROBLOX, glitches do sometimes happen where a player might accidentally stumble into these areas. Rather than punish the player (ie; kick/ban), you could simply teleport the player to a nearby known valid location.

1 Like

You don’t need all this code you just need to check when Humanoid.Changed is fired. Then check if PlatformStand = true kick them because all fly scripts i’ve seen have used platform stand

This is objectively false, as there are tons of methods to “Fly” without PlatformStanding the Humanoid. Rather than try to detect very specific changes to a humanoid (which really is a side-effect of certain cheat implementations), it is better to do a comprehensive check of the Character position itself, as this defeats all methods of “Fly” cheating.

1 Like

If your game has no sort of fast traveling like dashing or so you can do a :GetPropertySignalChanged() on the Velocity of the Character PrimaryPart and see if it goes over a certain limit because there are many ways to “Fly” which some includes BodyGyro and BodyVelocity and others may include other methods.

3 Likes

Hey, where exactly would I place this code? And in a Server Script or local script? Sorry im quite new to scripting

It’d be a local script, place it in starter character scripts if I remember right

Never place a anti exploit client side.
The server can get the cframe of the character.

Speed = Distance / Time – Detect any tp or speed

Using this simple equation can prevent tps as well as speed. To prevent flying or walking on client sided parts simply cast a ray. Keep an array that contains a few of the previous measurements and that will tell you exactly what is going on. You can also check the players spin speed from the cframe angles which can help check if they are being flung.

Dont just use one measure because its common practice, find whatever works best and use that.

that’s problematic for people who have lag issues

Not if done correctly, checks should be in the server anyway so it would have no adverse effects, i test with a bad laptop to ensure good performance