How to detect CFrame fly?

I’ve been working on an anti-cheat for my Roblox game that can detect flying, but I’ve run into a problem. If an exploiter spoofs their CFrame, it completely bypasses the system.

Does anyone know a better way to detect this, either on the server or client side?

3 Likes

Few things. Server side, you can add checks that shoot a ray down every so often, and if it’s above a certain threshold some amount of times in a row, log it and kick. Also, for players who are speed hacking, you can use checks that compare a player’s position every second and compare it to their last, seeing if they travel farther than they should have. If so, log and kick. Additionally, you can add some client-side checks to their velocity that run every frame, and when a player exceeds a threshold of your liking, you can log and kick.

Hey! Detecting if a player is “CFrame flying” (teleporting or moving unnaturally) is kinda tricky because Roblox doesn’t provide a direct API for it. You basically need to track movement MANUALLY and check for impossible changes.


What you can do is:

  1. Track last position and velocity
    Store the player’s last HumanoidRootPart.CFrame and compare it every frame:
local Players = game:GetService("Players")

local function monitorPlayer(player)
    local char = player.Character or player.CharacterAdded:Wait()
    local hrp = char:WaitForChild("HumanoidRootPart")
    local lastCFrame = hrp.CFrame

    game:GetService("RunService").Heartbeat:Connect(function()
        local delta = hrp.Position - lastCFrame.Position
        local maxDistance = 20 
        if delta.Magnitude > maxDistance then
            warn(player.Name .. " might be CFrame flying!")
        end
        lastCFrame = hrp.CFrame
    end)
end

Players.PlayerAdded:Connect(monitorPlayer)
  1. Check Humanoid state
    If the Humanoid is jumping or falling, allow bigger deltas. Otherwise, sudden changes indicate teleporting.
  1. Combine with RemoteEvents for critical actions
    For sensitive systems (like tools, damage, or speed limited areas), verify actions server-side and ignore events that happen after impossible movement.

Docs to check:

https://create.roblox.com/docs/reference/engine/classes/Humanoid

3 Likes

Tested it out and it worked, Thanks for the method.

1 Like

No Problem! Glad it helped you out.