Roblox Math Simulator Autofarm Script

Roblox Math Simulator Autofarm Script

Script by Kiko

local library = loadstring(game:HttpGet("https://raw.githubusercontent.com/LegoHacks/Utilities/main/UI.lua"))();
local mathSim = library:CreateWindow("Math Simulator");

mathSim:AddToggle({
   text = "Auto Solve";
   flag = "autoS";
});
mathSim:AddToggle({
   text = "Auto Purchase";
   flag = "autoS";
});
mathSim:AddList({
   text = "Purchase Option";
   flag = "apType";
   values = { "IQ", "Storage", "Rank" }
});

local SendAnswer = game:GetService("ReplicatedStorage").RemoteEvents.SendAnswer
local Change     = game:GetService("ReplicatedStorage").RemoteEvents.Change
local GetAnswers = function()
   local Answers = {}
   local CalculateFrame = game:GetService("Players").LocalPlayer .PlayerGui.MainGUI.Calculate.CALC
   for _, Obj in pairs(CalculateFrame:GetChildren()) do
       if Obj:IsA("TextButton") then
           table.insert(Answers, tonumber(Obj.Text))
       end
   end
   return Answers
end
local GetAlgebra = function()
   local CalculateFrame = game:GetService("Players").LocalPlayer.PlayerGui.MainGUI.Calculate.CALC
   return tonumber(CalculateFrame.NR.Text), CalculateFrame.BASE.Text, tonumber(CalculateFrame.ANS.Text)
end
local Upgrade    = function(...)
   game:GetService("ReplicatedStorage").RemoteEvents.Upgrade:InvokeServer(...)
end
local SellCredit = function()
   firetouchinterest(game.Players.LocalPlayer.Character.HumanoidRootPart, game:GetService("Workspace").SellPlace.SellTouchedHighlight, 1)
   firetouchinterest(game.Players.LocalPlayer.Character.HumanoidRootPart, game:GetService("Workspace").SellPlace.SellTouchedHighlight, 0)
end

library:Init();

while wait(.5) do
   if library.flags.autoS and library.flags.apType then
       Upgrade(library.flags.apType, true)
   end
   if library.flags.autoS then
       local a, b, c = GetAlgebra()
       if b == "+" then
           local d = GetAnswers()
           for _, Answer in pairs(d) do
               if a + Answer == c then
                   if SendAnswer:InvokeServer(Answer) then
                       SellCredit()
                   end
               end
           end
       elseif b == "-" then
           local d = GetAnswers()
           for _, Answer in pairs(d) do
               if a - Answer == c then
                   if SendAnswer:InvokeServer(Answer) then
                       SellCredit()
                   end
               end
           end
       elseif b == "*" then
           local d = GetAnswers()
           for _, Answer in pairs(d) do
               if a * Answer == c then
                   if SendAnswer:InvokeServer(Answer) then
                       SellCredit()
                   end
               end
           end
       elseif b == "/" then
           local d = GetAnswers()
           for _, Answer in pairs(d) do
               if a / Answer == c then
                   if SendAnswer:InvokeServer(Answer) then
                       SellCredit()
                   end
               end
           end
       else
           error("Unknown symbol.")
       end
       Change:FireServer()
       repeat
           wait()
       until b ~= tonumber(game:GetService("Players").LocalPlayer.PlayerGui.MainGUI.Calculate.CALC.BASE.Text)
   end
end
%d bloggers like this: