local config = {
autoUseYoYo = true,
autoSell = true,
autoBuyAllYoYo = false,
autoBuyAllBackpack = false
}
_G.AutoUseYoYo = config.autoUseYoYo
_G.AutoSell = config.autoSell
_G.AutoBuyAllYoYo = config.autoBuyAllYoYo
_G.AutoBuyAllBackpack = config.autoBuyAllBackpack
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local GameEvents = ReplicatedStorage:WaitForChild("GameEvents")
local ToolEvents = GameEvents:WaitForChild("ToolEvents")
local toolEvent = ToolEvents:WaitForChild("ToolEvent")
local sellEvent = GameEvents:WaitForChild("SellEvent")
local buyAllYoYoEvent = ToolEvents:WaitForChild("BuyAllTools")
local buyAllBackpackEvent = GameEvents:WaitForChild("BackpackEvents"):WaitForChild("BuyAllBackpacks")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local automationActive = false
local automationThread = nil
player.CharacterAdded:Connect(function(newCharacter)
character = newCharacter
end)
local function getYoYoColor()
for _, tool in ipairs(character:GetChildren()) do
if tool:IsA("Tool") and tool.Name:match("Yo%-Yo") then
return tool.Name
end
end
return nil
end
local function isAutomationEnabled()
return _G.AutoUseYoYo or _G.AutoSell or
_G.AutoBuyAllYoYo or _G.AutoBuyAllBackpack
end
local function stopAutomation()
if automationThread and coroutine.status(automationThread) ~= "dead" then
automationActive = false
wait(0.3)
end
end
local function runAutomationLoop()
automationActive = true
while automationActive and isAutomationEnabled() do
if _G.AutoBuyAllYoYo then
buyAllYoYoEvent:FireServer(player)
end
if _G.AutoBuyAllBackpack then
buyAllBackpackEvent:FireServer(player)
end
if _G.AutoUseYoYo then
local yoYo = getYoYoColor()
if yoYo then
toolEvent:FireServer(yoYo, player)
end
end
if _G.AutoSell then
sellEvent:FireServer("Home", player)
end
wait(0.2)
end
automationActive = false
end
local function monitorAutomation()
while true do
wait(0.5)
if isAutomationEnabled() and not automationActive then
automationThread = coroutine.create(runAutomationLoop)
coroutine.resume(automationThread)
end
config.autoUseYoYo = _G.AutoUseYoYo
config.autoSell = _G.AutoSell
config.autoBuyAllYoYo = _G.AutoBuyAllYoYo
config.autoBuyAllBackpack = _G.AutoBuyAllBackpack
end
end
function ToggleAutoUseYoYo()
_G.AutoUseYoYo = not _G.AutoUseYoYo
if not isAutomationEnabled() then stopAutomation() end
end
function ToggleAutoSell()
_G.AutoSell = not _G.AutoSell
if not isAutomationEnabled() then stopAutomation() end
end
function ToggleAutoBuyAllYoYo()
_G.AutoBuyAllYoYo = not _G.AutoBuyAllYoYo
if not isAutomationEnabled() then stopAutomation() end
end
function ToggleAutoBuyAllBackpack()
_G.AutoBuyAllBackpack = not _G.AutoBuyAllBackpack
if not isAutomationEnabled() then stopAutomation() end
end
function SetAutoUseYoYo(value)
_G.AutoUseYoYo = value
if not isAutomationEnabled() then stopAutomation() end
end
function SetAutoSell(value)
_G.AutoSell = value
if not isAutomationEnabled() then stopAutomation() end
end
function SetAutoBuyAllYoYo(value)
_G.AutoBuyAllYoYo = value
if not isAutomationEnabled() then stopAutomation() end
end
function SetAutoBuyAllBackpack(value)
_G.AutoBuyAllBackpack = value
if not isAutomationEnabled() then stopAutomation() end
end
spawn(monitorAutomation)
Comments