I have looked at a lot of tutorials on Youtube but I can not seem to find a farming system that saves. I tried thinking of an algorithm but I just can't, I have seen some farming games and wonder how they did it. I'm not really looking for some code, I'm just looking for an algorithm. But anything helps!

ps I just started scripting a few months ago so I am not really experienced on scripting