There is only two things you can check server side that is velocity and position.
I am almost certain there is no other way…unless the HumanoidStateTypes are replicated which they probably aren’t and you could get around that by disablign them too.
You might just want to put an kick system and report system in place. much easier to do
I don’t even think you can, phantom forces also has tons of people using that right now. It would be pretty cool is roblox just gave us access to the tweens in tweenservice, to simply compare whats running in tweenservice to what we actually want.
There is a way to detect it using a zone script, obviously, you know they can’t reach certain areas, if you were to mark all the areas they could touch (including a little bit off of cliffs in case they jump off) then a flying person would get flagged if they somehow exited the area.
If you choose this option I highly recommend you check out zoneplus V2
The only way I could think of doing this without using zones is checking for nearby cliffs using a ray to the nearest cliff, however this seems like a worse solution than simply running zones
I’m aware that’s what you mean, but regardless the only way you could avoid the aforementioned false positives is to check If they jumped off a cliff, which is why you would check if there is a nearby cliff.
Make a raycast down, and compare the position.
Like this;
local RaycastDown = workspace:Raycast(self.Character.HumanoidRootPart.Position,Vector3.new(0,1,0) * -250,Params)
if (RaycastDown) then
if (self.Data.LastFlyPosition) then
local DifferenceY = (self.Character.HumanoidRootPart.Position-self.Data.LastFlyPosition).Y
if (DifferenceY > self.Humanoid.JumpHeight * 1.2) then
self:Kick('Flying')
elseif (math.floor(DifferenceY) == 0) then
self.Data.LastFlyPosition = self.Character.HumanoidRootPart.Position
elseif (DifferenceY < 0) then
self.Data.LastFlyPosition = self.Character.HumanoidRootPart.Position
end;
else
self.Data.LastFlyPosition = self.Character.HumanoidRootPart.Position
end;
end;
Here is a piece of an anti-exploit I made, hope it helps
With the current set of tools available to developers, its hard to do this.
Personally, I would keep track of the last highest position they had the last time they were on the ground (You can use FloorMaterial and/or raycasting for this, record it every heartbeat or something) and then compare it to where they are in the air at each interval.
From what I’ve seen and used, you can connect an anti fly check function to heartbeat to run every 0.2-0.5 seconds.
Some ways to do this include:
compare last primary part positions in the y axis
raycast a certain distance down to validate if they are on the floor or in the air.
(i’ve never done this, but just an idea) region3 to detect any parts around the character (filtering its descendants) - no parts detected would mean they are in the air
These methods may be performance intensive so having a good interval (not to small, not to high), between checks is important.
The problem though lies within false positives. You could try having a maximum amount of flags, make it high, and if they have been detected multiple times, you could then respawn them or teleport them back. This can stop many false positives such as falling. Important: make sure that after each flag or exploit detected, have a 7-10 second (or however high you want it) cooldown before the next check.
You are gonna want to check the Humanoid's FloorMaterial property and make sure it’s not nil for too long, because if it is, it means they have been suspended in the air for some time. You also need to average out the maximum amount of time a player can be falling in your game, and if it’s above that by some margin, then they should be flying.
I’m sorry to disappoint you but any exploiter can spoof their humanoid’ properties using meta tables and what not, so it’s best to stay away from using anything to with events and data with the humanoid. Ex: server sees player’s humanoid floor material as cobblestone, client’s is actually air, but spoofed from replication
If you want to be hacky, you could have a fake invisible and uncollidable humanoid controlled by the server follow the player’s position, and check their FloorMaterial. I it would only require a HumanoidRootPart and a Humanoid, too.
Exploiters can spoof that humanoid’s properties as well… If it’s in the workspace, they can see it, no matter if it’s invisible or whatnot. Literally anything on the client can be spoofed, changed or exploited, which is why there is no one-stops-all anti exploit for flying or any exploit for that matter, usually involving physics.