Hello, I have a very painful problem that I have not found a solution to yet, I need everyone’s help and teaching.
I want to make an anti-teleport that can detect even the smallest distance of cheater teleport, in the game “Steal A Brainrot”, I saw they did it but I don’t know how they did it and what they used to be able to do it, I hope everyone can teach and help me
I have tried the following measures:
Magnitude (Need cheater teleport long distance, close distance can’t detect)
MoveDirection (I don’t understand how to calculate cheater teleport while walking)
Following Part (I used following part to make part follow player and check if distance is abnormally long, doesn’t work with close distance)
You gotta check it in a run service loop tbh, make sure it runs every frame to accurately measure the magnitude, use the players ping to add a bit of leeway, and have a count system that tracks the amounts of warnings set off in a short interval, say someone flags that they’re teleporting once, it may be lag or something else so you start a temporary count of flags triggered in the next X interval ( you can choose maybe 5 seconds or greater or less it depends ). If the amount of flags set off is greater than some upper limit you chose, then consider it a cheat. Teleportation will greatly increase the magnitude from one frame to another even for a short distance because its simply distance over time and if the time elapsed between a frame is Heartbeat:Wait() then you can find that their magnitude would skyrocket
Something like this can be done in many ways depending on how intense you want the detection to be. As @FusionOBC mentioned, a check function based on RunService could work for maximum accuracy, just checking a cached Player.Character.HumanoidRootPart position versus the current position with a maximum distance set as the detection barrier.
A far less intrusive method is to have the game check every x seconds each player’s position and compare it to their previous position the last check, and if the distance is more than the player could have walked in that time: Player:Kick()
Both options would use a decent amount of memory in storing a HRP.Position for every player in the game.