if math.floor((Vector3.new(lastcf.p.X, 0, lastcf.p.Z) - Vector3.new(, 0, )).magnitude) > maxspeed then This is how often we will compare the player’s position. It looks messy here, but I will decipher it line-by-line so you can understand what is going on! First: while wait(checktime) do Lastcf = root.CFrame -We store the player's position so we can see if they're hacking later! Instead, we peacefully move them back to their last known valid position! Root.Parent:SetPrimaryPartCFrame(lastcf) -The player is hacking! Because this could be a false positive, we DO NOT KICK THE PLAYER. See how we ignored the Y axis in the calculation? Also notice how we rounded on the line above? This prevents an inaccurate reading. If it's greater than maxspeed, they're hacking. )).magnitude) > maxspeed then -We compare the length of the last known position, lastcf.p, with the current position, root.Position. If math.floor((Vector3.new(lastcf.p.X, 0, lastcf.p.Z) - Vector3.new(, 0, Now, for the actual checking, add this beneath your variables: while wait(checktime) do This is because we might get false positives from slower players who are still moving at 16 WalkSpeed but appear to be moving slightly faster to the server. They need to stay somewhat proportional to each other, or we might get false readings!Īlso note how I didn’t make maxspeed 17, directly above the default 16 WalkSpeed. Note the values for maxspeed and checktime. Local lastcf = root.CFrame -We will store the player's CFrame so that we can move the player there if they seem to be hacking. Local root = script.Parent:WaitForChild("HumanoidRootPart") -Get HumanoidRootPart so we can keep track of the player's position. If we make checktime too fast, like ".1", the script will be recording positions too fast and thus will fail to work correctly! Local checktime = 1 -How many seconds we wait before we record their speed. Let’s add some variables first: local maxspeed = 22 -The maximum distance the player can travel within a check time. To begin, place a script into StarterCharacterScripts. We cannot rely on properties like WalkSpeed or Velocity to catch a hacker, but we can compare their positions to see if they’re cheating! Don’t freak out if that sounds too complex for you, because it’s actually really easy. If a player seems to be moving too fast, we stop them. The best way to detect a speed hacker is to check their location on the server. This means we need a way to detect ALL speed hacks, not just a specific method of doing it. The most basic hack could alter the player’s WalkSpeed, and more advanced hacks can change their FPS. Before we can stop speed hackers, we need to know how they speed hack in the first place! The truh is, there’s no single way people do this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |