ADVERTISEMENTREMOVE ADS
Autobuy Seeds + Gears
46,851 views

Script Preview
Description
This script is extremely simple. All it does is buys all the seeds and all the gears when you call the functions at the bottom of the script. Could be used in your autofarms or autobuy seeds, gears, cosmetics ??.
Open sourced as a learning tool to help make Grow A Garden farms/ automatic systems.
Features:
- Autobuy Seeds
- Autobuy Gears
Tested with
ADVERTISEMENTREMOVE ADS
75 Lines ⢠2.84 KiB
local RS = game:GetService("ReplicatedStorage")
local seeds = require(RS.Data.SeedData)
local gears = require(RS.Data.GearData)
local remotetobuytheseeds = RS.GameEvents.BuySeedStock
local remotetobuythegear = RS.GameEvents.BuyGearStock
local seedshopui = game:GetService("Players").LocalPlayer.PlayerGui.Seed_Shop.Frame.ScrollingFrame
local gearshopui = game:GetService("Players").LocalPlayer.PlayerGui.Gear_Shop.Frame.ScrollingFrame
local function howmanyseedsarethereinstock(seed)
local alltheseeds = seedshopui:GetChildren()
if #alltheseeds > 0 then
for _, frame in ipairs(alltheseeds) do
if frame.Name == seed then
if frame:WaitForChild("Main_Frame"):WaitForChild("Stock_Text") then
local stock = frame:WaitForChild("Main_Frame"):WaitForChild("Stock_Text").Text
local howmanyareinstock = tonumber(stock:match("X(%d+) Stock"))
if howmanyareinstock and howmanyareinstock > 0 then
return howmanyareinstock
else
return 0
end
end
end
end
end
return 0
end
local function howmanygearsarethereinstock(gear)
local allthegears = gearshopui:GetChildren()
if #allthegears > 0 then
for _, frame in ipairs(allthegears) do
if frame.Name == gear then
if frame:WaitForChild("Main_Frame"):WaitForChild("Stock_Text") then
local stock = frame:WaitForChild("Main_Frame"):WaitForChild("Stock_Text").Text
local howmanypearsareinstock = tonumber(stock:match("X(%d+) Stock"))
if howmanypearsareinstock and howmanypearsareinstock > 0 then
return howmanypearsareinstock
else
return 0
end
end
end
end
end
return 0
end
local function buyalltheseedscurrentlyinstock()
for nameoftheseed, _ in pairs(seeds) do
local numberofseedsinstock = howmanyseedsarethereinstock(nameoftheseed)
if numberofseedsinstock > 0 then
for i = 1, numberofseedsinstock do
remotetobuytheseeds:FireServer(nameoftheseed)
task.wait()
end
end
end
end
local function buyallthegearscurrentlyinstock()
for nameofthegear, _ in pairs(gears) do
local numberofgearsinstock = howmanygearsarethereinstock(nameofthegear)
if numberofgearsinstock > 0 then
for i = 1, numberofgearsinstock do
remotetobuythegear:FireServer(nameofthegear)
task.wait()
end
end
end
end
buyalltheseedscurrentlyinstock()
buyallthegearscurrentlyinstock()
ADVERTISEMENTREMOVE ADS
ADVERTISEMENTREMOVE ADS






Comments
add cosmetic shop, eggs
@MattMunsanator you could probably add it by using the same methods ill look into it when i have time and update the script and notify you if I make changes