Autofarm script ruining my game

Hey, I’m the developer of math simulators and very shortly after release, exploiters already made an autofarm script that teleports their character to the coins. This is severely hurting the game and I don’t know how to stop exploiters :frowning:

8 Likes

You could create an AntiCheat for your game by detecting the position of the character every so often and comparing it to the old position. If the distance is too far you could kick them.

1 Like

I am no expert, but that happens in game, I tried to make it if that they get 30 coins very fast they get warned, or kicked. That is a simple solution that I thought of, gl getting it patched.

Sorry if I’m not descriptive enough, just giving you a starter.

It would be helpful if you were to post more details here.

Exploiting is always something one must account for when making a game.

There are different ways people might exploit, and thus various security practices you will want to use.

For example, you process things like money transactions on the server (most people already know to do this) and the same thing with applying damage to other players when they get hit with a bullet.

As I said, that’s pretty universal. It can become more complicated though when it comes to deeper level exploits. (Ie not all exploits are surface level like speed hacking) Based off of your brief description, it sounds like there are two problems

(When I say client I mean the software on the player’s computer, and when I say player I mean the dude sitting at a chair playing the game)

  1. The client can teleport with no consequences
  2. The client can know where all the coins are

#1
There are a few ways to solve this. Probably the easiest would be to make a script on the server that checks the distance a player has moved within a given amount of time and either rubberband them back or kick them if they move too far. This would also prevent speed hacking. Another way to fix this would be more complicated but could involve checking the direction they move and if they go through walls, etc.

#2
I don’t have much information about this but it sounds like the clients have access to where the coins are. You could potentially devise a system that only loads in a few near the player to the client so that they dont have access to a full list of where coins are.

Another way you could prevent cheating is to rate limit picking up coins like @galaxyblazing said.

Edit:

My personal recommendation for a quick fix would be to check every 0.2 seconds or something and see if the player moved >50 studs from their original position or something. If they do, TP them back and give them a tally. If they hit two or three tallies kick them from the game. The reason I wouldn’t recommend insta kicking is that sometimes physics can crap out and fling your player.

10 Likes

we have a button ingame that teleports the player to the shop. idk if that can false ban the player

1 Like

Always teleport the player via the server. If you want to avoid a false positive you can just mark that the player is teleporting and where the player is going.

4 Likes

Thank you for the help. I’m still very new to coding and it’s been pretty stressful.

1 Like

You could make a script that only allows you to get a certain amount of coins at once, so maybe like you can only get 10 coins per minute.

1 Like

it would add more waiting to the game if I were to do that. but it is a solution that will solve the problem

2 Likes

As @plasma_node said, we don’t have enough details to be able to find the exact problem.

Could you post a code snippet or try to describe the way some of the coin-related code works so that we can have a better idea of what your approach was?

Aside from that, if you’re completely new to game security, check out this Developer Forum article on the client-server model to learn the very basics:

and check out this thread for a more in-depth explanation:

2 Likes

It’s best to teleport them back in this case. If someone lagged this would kick them from the game.

I think the problem is really clear. Players are teleporting themselves to coins when they are dropped.
You don’t need all this in-depth stuff to know what exactly is going on. Because it’s already clear enough.
As if he would know what executor they are using and as if you need his code, because you don’t.

This thread has already been solved so you can stop responding to it. @mathep I recommend you look around the forum and stuff to find what you are looking for. I have seen some anti teleport scripts in the Forum. If you need further help don’t be afraid to throw me a PM as I am free almost always.

Here’s a good post with some code lol

There is a door for the coins zone, right? If so, then when the player touches it, insert a value in it, and also make a region for the coins zone and check if a player is in and if it doesn’t have the value when touching the door, warn them, or kick them.

In exploits theirs many ways to bypass detecting the position of the character. What I would do is add checks on the givers and put them in a table and how many times you had sold your (Dirt for example) if the number seems like an impossible number on guessing that players would not get a lot of your items in a short time period. For example you’re mining you wont just mine and insistently get like a impossible number of good dirt blocks and sell them.

1 Like

Hi everyone, I’m new to the forum, Well, to put you in context a bit, I have a problem with an auto farm script, I was able to patch one, but they found another method, I show you the script, But my question is, Is there a way to patch this method?

local Positions = {} coroutine.resume(coroutine.create(function() for i,v in pairs(game.Workspace.Coins:GetChildren())do table.insert(Positions,v.Position) end end)) local Index = 1 while true do wait(0.1) game.Players.LocalPlayer.Character.PrimaryPart.CFrame = CFrame.new(Positions[Index]) Index = Index + 1 end

Thank You, I’m kind of excited to discover new things here!

You can create a event for if a player touches a coin.
Or put a limit or a time limit.

1 Like

This is an automatic calculator script I made.

--Calculator script
 
local Calculate = game.Players.LocalPlayer.PlayerGui.MainGUI.Calculate.CALC
local function calculate()
local symbol = Calculate.BASE.Text 
local number = Calculate.NR.Text
local answer = Calculate.ANS.Text
if symbol == "-" then
    local A_1 = number-answer
    local Event = game:GetService("ReplicatedStorage").RemoteEvents.SendAnswer
    Event:InvokeServer(A_1)
end
if symbol == "+" then
    local A_1 = answer-number
    local Event = game:GetService("ReplicatedStorage").RemoteEvents.SendAnswer
    Event:InvokeServer(A_1)
end

if symbol == "*" then
    local A_1 = answer/number
    local Event = game:GetService("ReplicatedStorage").RemoteEvents.SendAnswer
    Event:InvokeServer(A_1)
end

if symbol == "/" then
    local A_1 = answer*number
    local Event = game:GetService("ReplicatedStorage").RemoteEvents.SendAnswer
    Event:InvokeServer(A_1)
end
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Workspace.SellPlace.SellTouchedHighlight.CFrame
end
    
Calculate.BASE.Changed:connect(calculate()) 
Calculate.NR.Changed:connect(calculate())
Calculate.ANS.Changed:connect(calculate())```

Oh try that, it really worked for me, thank you so much!