Need help on harvesting system for simulator

I want to make a harvest system where there is a click detector on an object and when you click on it you run up to it, and once you enter a certain range around the object you will start to harvest/mine it. I want the harvesting to be automatic(you click once and it will harvest automatically until you walk away) This system is much like Pet Simulator but except it would be the player walking up to the object instead of the pet.
Or another example would be Unboxing Simulator. Pretty much the same as what I’m looking for.

I’ve tried doing a repeat on the humanoid:MoveTo() until it touches the hitbox the object. This kind of worked but it was buggy and would only work sometimes.

Any help would be appreciated! :slight_smile:

1 Like

You can make a click detector, check the character’s magnitude (the distance from the player to the crops). Then, for automatic harvesting you can use Humanoid: MoveTo to move to random crops. You can select a random crop to move to by this:

local crop_folder = CHANGE
local randomcrop = crop_folder[math.random(#crop_folder)]

Humanoid:MoveTo (
Magnitude (
ClickDetector.MouseClick (

The player can disable the MoveTo loop by pressing any key, so you can use UserInputService (