Milk Tycoon Autofarm Script

Thank you for using our website
Your script:

--https://rbscripts.com
local player = game.Players.LocalPlayer;
local char = player.Character;
local bonus = game:GetService("Workspace").Obby.RewardPart;
local wind = game:GetService("Workspace").Obby.Windmill.BlowFunction.TouchPart;
local foot = char.LeftFoot;

local my_tycoon = nil;
_G.start = false; --enables me to quick restart while developing
wait(3);
_G.start = true;
if(_G.start ~= true) then
        return;
end

while wait(0.1) and my_tycoon == nil and _G.start == true do
        for _,tycoon in pairs(game:GetService("Workspace").Tycoons:GetChildren()) do
                if(tycoon:FindFirstChild("Owner").Value == player.Name) then
                        my_tycoon = tycoon;
                end
        end
end

local buy_dictionary = {
        upgrade = {
            button = my_tycoon.Buttons.Upgrade,
            condition = function() return true; end
        },
        cow = {
            button = my_tycoon.Buttons.Cow,
            condition = function() return true; end
        },
        process = {
            button = my_tycoon.Buttons.ProcessorTick,
            condition = function()
                if(tonumber(my_tycoon.Processor.Main.BillboardGui.Title.Text) > 1000) then
                    return true;
                end
                return false
            end
        },
        sell = {
            button = my_tycoon.Buttons.SellTick,
            condition = function()
                if(tonumber(my_tycoon.Tank.Main.BillboardGui.Title.Text) > 1000) then
                    return true;
                end
                return false
            end
        },
};
local buy_items = {
    buy_dictionary.upgrade,
    buy_dictionary.upgrade,
    buy_dictionary.cow,
    buy_dictionary.cow,
    buy_dictionary.process,
    buy_dictionary.process,
    buy_dictionary.sell,
    buy_dictionary.sell,
}

local buy_time = 0;
local try_buy = function()
        if(buy_time > os.time()) then return; end
        buy_time = os.time() + 5;
        for _,item in pairs(buy_items) do
            if(item.condition()) then
                firetouchinterest(foot,item.button,1);
                wait(0.5);
                firetouchinterest(foot,item.button,0);
                wait(2);
            end
        end
end


local processor = my_tycoon.Buttons.Process;
local collect = function()
        for _,drop in pairs(my_tycoon.Drops:GetChildren()) do
            local part = drop:FindFirstChild("HitBox");
            if(part == nil) then
                part = drop:FindFirstChildOfClass("Part");
            end
            if(part) then
                part.CFrame = char.HumanoidRootPart.CFrame;
            end
        end
        firetouchinterest(foot,processor,1);
        wait(0.1);
        firetouchinterest(foot,processor,0);
        wait(0.1)        
end

local obby_time = 0;
local do_obby = function()
        if(obby_time  > os.time()) then return; end
        local oldCFrame = char.HumanoidRootPart.CFrame;
        obby_time = os.time() + 95;
        firetouchinterest(foot,wind,1);
        wait(.1);
        firetouchinterest(foot,wind,0);
        wait(.1);
        firetouchinterest(foot,bonus,1);
        wait(.1);
        firetouchinterest(foot,bonus,0);
        wait(1.5);
        char.HumanoidRootPart.CFrame = oldCFrame;
end

while wait(1) and _G.start do
        spawn(function() collect(); end);
        spawn(function() try_buy(); end);
        spawn(function() do_obby(); end);
end