What are some methods to prevent movement exploits?

I want to make a serversided anti-fly/speed/teleport exploit.

After looking on multiple DevForum posts with the same question as me, I’m left with people avoiding the question and saying “secure your remotes” and “don’t trust the client” which is valid advice, but with how much those terms are thrown around, people for sure have heard the advice before. The DevForum encourages you to use the search bar, yet if anybody searches it, they will be hit with the terms I just said. Then people repeat it as if they haven’t used the search bar. What am I trying to say here? People know what they’re asking, so don’t say something that everybody would know by using the search bar.

Sorry for the tangent, and I’m sorry if I come across as rude, I’m just annoyed. For example, let’s say I was creating a game where you collect coins randomly spawned across the map and everything is managed on the server. What’s stopping exploiters from, for example, teleporting to every coin? Even if the game had time detections to see how fast you were collecting coins, exploiters could still make a delay and teleport. This is pretty much called an auto farm.

So, I’m sorry that 90% of the post was a rant, I just didn’t want responses like that. And please don’t just reply with something arguing with what I said, because I know the example and stuff I said probably isn’t perfect, I just said that because I didn’t want those responses, and responses of people arguing with that is the same help as people saying that stuff. So, I don’t expect any of you to write me a whole script, just go over some methods and I’ll expand from there. If you do feel inclined that what I said was so wrong, just try to help and you can argue in the same post.

Also, I’m doing this for fun, the example isn’t the actual game I have laid out. Thank you so much, bye.

1 Like

Do you use teleportation normally?
If not, you might be able to use something like this: (On a serverscript)

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Wait()
    local char = plr.Character
    local lastRootPart = char.HumanoidRootPart.Position -- Might need to use a WaitForChild here
    game["Run Service"].Heartbeat:Connect(function()
        if char then
            if (char.HumanoidRootPart.Position - lastRootPart).Magnitude > 50 then -- You can change the 50
                plr:Kick("no teleporting noob")
                return
            lastRootPart = char.HumanoidRootPart.Position
        else
            if plr then
                repeat
                    task.wait()
                    char = plr.Character
                until char or not plr
            else
                return
            end
        end
    end)
end)
1 Like

I haven’t tested or anything but I’m guessing you can run a heartbeat through the server to store and constantly update all player locations, and if there is a large increase or decrease you can set an event that resets them to their normal location. Not quite sure how optimal it would be for ping or anything but I’m just throwing my few cents out there. Hope you find a solution soon!

2 Likes