Preventing people from using fling cheats on other players

I am having a problem with people using client-sided cheats to fling themselves into other users, causing both players to fly across the map. I cannot disable player-collision because it’s essential for the game.

I also can’t automatically kick/punish players for moving too quickly, because there is no way (that I can find out) for the server to tell the difference between the player who is doing the flinging versus the victim who is being flung.

Does anybody know of a good technique to prevent this type of cheating?

1 Like

You could probably, instead of kicking/punishing the players, just immediately set their velocity to (0,0,0) and maybe even set their humanoid state to Running just to make sure they aren’t in a flung state anymore.
This way, you’re not auto-kicking either of them, but it still stops/ reverts the incident so that it’s not happening anymore.
If this happens to laggy players, they would probably not even notice.

1 Like

I thought about this type of implementation, but a cheater could still use this to grief a player by repeatedly attempting to fling them, causing both players to be ‘frozen’ and repeatedly set to 0 velocity.

Would teleporting the two players further from each other resolve the issue by any chance, especially in the case that it’s happening multiple times? This might just be a band-aid though.

You could even teleport them further away for each iteration until it doesn’t happen anymore.

I don’t think this would work because then you could teleport people through walls, and grief them by locking them outside the map.

Maybe You could try drawing a ray, and teleporting them a stud or two away from the point it hits to prevent that from happening.

Assuming you can define a “max speed” for your character you can detect this relatively easily and also prevent it seamlessly. Basically you probably want to verify player movement and speed.

First off you will want to use RunService.Heartbeat since it runs immediately after each physics frame. Now keep track of each player’s position and velocity. Your first check will determine if a player has teleported. Check if the distance of their HumanoidRootPart from the last frame is greater than their speed (e.g. Velocity.Magnitude) multiplied by the frame time. You’ll want to add a little leeway here to account for lag. Just add a few studs to their speed. This basically will check that the player is moving within their current speed.

Your second check is to check if the player’s horizontal speed is faster than their max speed. You can do this by canceling out their Y speed (Velocity*Vector3.new(1, 0, 1) and checking if the Magnitude is greater than their max speed.

Optionally check if their Y speed is greater than their jump power give or take some. Their fall speed can’t be reliably checked since it will increase over time.

These checks will garauntee the player isn’t teleporting and will verify that they aren’t moving too fast.

When you detect an invalid value you can reset their CFrame and Velocity to the last frame’s CFrame and Velocity.

1 Like