Advertisement
seehuangdeung

Critical Revengeance Script

Apr 23rd, 2024 (edited)
1,020
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.18 KB | None | 0 0
  1. -- Join the discord for suggestions / updates to future versions
  2. -- https://discord.gg/56Wr5TDM5t
  3. -- The auto mob is very buggy and doesnt work atm so I recommend not using it.
  4. -- Some shops will kick you im not sure which tell me in discord which shop kicks you.
  5.  
  6. -- // GLOBALS
  7.  
  8. getgenv().connections = connections or {}
  9.  
  10. -- // VARIABLES
  11.  
  12. local player = game.Players.LocalPlayer
  13.  
  14. local enemiesWs = workspace.Enemies
  15. local oresWs = workspace.Harvestables.Ores
  16. local chestSpawnsWs = workspace.ChestSpawnLocations
  17. local areaZonesWs = workspace.Area_Hitboxes
  18. local shrinesWs = workspace.NewStatues
  19. local shopsWs = workspace.Shops
  20.  
  21. local enemiesRs = game:GetService("ReplicatedStorage").Enemy
  22.  
  23. local receiveDamageRm = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("Damage")
  24. local combatTriggerRm = workspace:WaitForChild("Enemies"):WaitForChild("Grassy Fields"):WaitForChild("Enemy"):WaitForChild("CombatTrigger")
  25. local itemSetupRm = game:GetService("ReplicatedStorage"):WaitForChild("Remotes"):WaitForChild("ItemSetup")
  26. local healRm = game:GetService("ReplicatedStorage").Remotes.Heal
  27.  
  28. -- // FUNCTIONS
  29.  
  30. do -- [[ GENERAL HELPERS ]]
  31.    
  32.     function movePlrToPosition(part, amountOfTime)
  33.  
  34.         local hrp = player.Character.HumanoidRootPart
  35.         local newVelocity = Instance.new('LinearVelocity')
  36.         local dis = (hrp.Position - part.Position).Magnitude
  37.  
  38.         newVelocity.MaxForce = math.huge
  39.         newVelocity.Attachment0 = hrp.RootAttachment
  40.         newVelocity.VectorVelocity = (part.Position - hrp.Position).Unit * 70
  41.         newVelocity.Parent = hrp
  42.  
  43.         repeat
  44.             newVelocity.VectorVelocity = (part.Position - hrp.Position).Unit * 70
  45.             task.wait()
  46.         until part == nil or part.Parent == nil or not Toggles['MOBS_AUTOFARM'].Value
  47.  
  48.         newVelocity:Destroy()
  49.     end
  50. end
  51. do -- [[ FETCHER HELPERS ]]
  52.  
  53.     function getInventoryData(plr)
  54.         plr = plr or player
  55.  
  56.     end
  57.     function getAllMobTypes()
  58.         local tbl = {}
  59.         for _, folder in enemiesRs:GetChildren() do
  60.             if not folder:IsA('Folder') then continue end
  61.             for _, mobModel in folder:GetChildren() do
  62.                 table.insert(tbl, mobModel.Name)
  63.             end
  64.         end
  65.         return tbl
  66.     end
  67.     function getAllZones(stringArrayBool)
  68.         local t = {}
  69.  
  70.         for _, areaPart in areaZonesWs:GetChildren() do
  71.             table.insert(t, areaPart.Name)
  72.         end
  73.  
  74.         if stringArrayBool then
  75.             return t
  76.         else
  77.             return areaZonesWs:GetChildren()
  78.         end
  79.     end
  80.     function getInstanceChildrenAsArray(instance, ofInstanceType, excludedStrArray)
  81.         local t = {}
  82.         for _, child in instance:GetChildren() do
  83.             if ofInstanceType ~= nil then
  84.                 if not child:IsA(ofInstanceType) then continue end
  85.             end
  86.             if excludedStrArray ~= nil then
  87.                 if table.find(excludedStrArray, child.Name) then continue end
  88.             end
  89.             table.insert(t, child.Name)
  90.         end
  91.         return t
  92.     end
  93. end
  94. do -- [[ AUTOFARMS ]]
  95.  
  96.     function initMobAutoFarm()
  97.         --This will initialize the autofarm, and will listen to a value changed event.
  98.  
  99.         Toggles['MOBS_AUTOFARM']:OnChanged(function()
  100.             local bool = Toggles['MOBS_AUTOFARM'].Value
  101.             print(bool)
  102.  
  103.             if bool then
  104.                 local whitelistedMobs = Options.MOBS_WHITELIST.Value
  105.  
  106.                 for _, enemyModelFolder in enemiesWs:GetChildren() do
  107.                     if not enemyModelFolder:IsA('Folder') then continue end
  108.                     for _, enemyModel in enemyModelFolder:GetChildren() do
  109.                         if not enemyModel:IsA('Model') then continue end
  110.                         if not whitelistedMobs[tostring(enemyModel.Model.Value)] then continue end
  111.                         local combatFolder = nil
  112.                         local orbsFolder = nil
  113.  
  114.                         --warn(enemyModel.Model.Value)
  115.  
  116.                         repeat
  117.                             player.Character:PivotTo(enemyModel.WorldPivot)
  118.                             task.wait(.05)
  119.                         until game.Workspace:FindFirstChild('CombatFolder') ~= nil or not Toggles['MOBS_AUTOFARM'].Value
  120.                         --rconsoleprint('Got CombatFolder')
  121.  
  122.                         combatFolder = game.Workspace.CombatFolder
  123.                         orbsFolder = combatFolder:WaitForChild(player.Name)
  124.  
  125.                         repeat
  126.                             if #orbsFolder:GetChildren() == 0 then
  127.                                 --player.Character:PivotTo(enemyModel.WorldPivot * CFrame.new(0,20,0))
  128.                             end
  129.                             for _, orb in orbsFolder:GetChildren() do
  130.                                 repeat task.wait() until orb.PrimaryPart ~= nil
  131.                                 movePlrToPosition(orb.PrimaryPart, 2)
  132.                                 --player.Character:PivotTo(orb.WorldPivot)
  133.                                 repeat
  134.                                     task.wait(.1)
  135.                                     --player.Character:PivotTo(orb.WorldPivot)
  136.                                 until orb == nil or orb.Parent == nil
  137.                             end
  138.                             task.wait(.05)
  139.                         until enemyModel == nil or enemyModel.Parent == nil or combatFolder == nil or not Toggles['MOBS_AUTOFARM'].Value
  140.                     end
  141.                 end
  142.  
  143.             end
  144.         end)
  145.  
  146.     end
  147.  
  148.     function initOreAutoFarm()
  149.         --This will initialize the autofarm, and will listen to a value changed event.
  150.         local function getMineableOres()
  151.             local amountMineable = 0
  152.             for _, ore in oresWs:GetChildren() do
  153.                 if not Options['ORES_DROPDOWN'].Value[ore.Name] then continue end
  154.                 if ore.HasOre.Value == true then amountMineable += 1 end
  155.             end
  156.             return amountMineable
  157.         end
  158.  
  159.         local function getClosestOre()
  160.             local closestOre, closestDis = nil, math.huge
  161.             for _, ore in oresWs:GetChildren() do
  162.                 if not Options['ORES_DROPDOWN'].Value[ore.Name] then continue end
  163.                 if ore.HasOre.Value == false then continue end
  164.                 local mag = (player.Character.PrimaryPart.Position - ore.Position).Magnitude
  165.                 if mag < closestDis then
  166.                     closestDis = mag
  167.                     closestOre = ore
  168.                 end
  169.             end
  170.             return closestOre
  171.         end
  172.  
  173.         Toggles['ORES_AUTOFARM']:OnChanged(function()
  174.             local bool = Toggles['ORES_AUTOFARM'].Value
  175.             print(bool)
  176.             if bool then
  177.                 itemSetupRm:FireServer('Silver Pickaxe')
  178.                 itemSetupRm:FireServer('Titanium Pickaxe')
  179.                 local lastLoggedCFrame = player.Character.PrimaryPart.CFrame
  180.                 repeat
  181.                     local closestOre = getClosestOre()
  182.                     local proxPrompt = closestOre:FindFirstChildWhichIsA('ProximityPrompt')
  183.  
  184.                     repeat
  185.                         player.Character:PivotTo(closestOre.CFrame)
  186.                         fireproximityprompt(proxPrompt)
  187.                         task.wait(.1)
  188.                     until closestOre.HasOre.Value == false or not Toggles['ORES_AUTOFARM'].Value
  189.  
  190.                     task.wait(.05)
  191.                 until not Toggles['ORES_AUTOFARM'].Value
  192.  
  193.                 --warn('Finalized Ores Autofarm')
  194.                 player.Character:PivotTo(lastLoggedCFrame * CFrame.new(0,5,0))
  195.             else
  196.             end
  197.         end)
  198.  
  199.     end
  200.  
  201.     function initChestAutoFarm()
  202.         local function attemptOpenChest(chestModel)
  203.             local lastCFrame = player.Character.PrimaryPart.CFrame
  204.             local proxPrompt = chestModel.Box.ChestPrompt
  205.             repeat
  206.                 player.Character:PivotTo(chestModel.Box.CFrame * CFrame.new(0,1,0))
  207.                 fireproximityprompt(proxPrompt)
  208.                 task.wait(.1)
  209.             until proxPrompt.Enabled == false or not Toggles['CHESTS_AUTOFARM'].Value or chestModel == nil
  210.             player.Character:PivotTo(lastCFrame)
  211.         end
  212.  
  213.         for i, chestHolder in chestSpawnsWs:GetChildren() do
  214.             connections['chest_' .. i] = chestHolder.ChildAdded:Connect(function(child)
  215.                 task.wait(.3)
  216.                 if Toggles['CHESTS_AUTOFARM'].Value then
  217.                     attemptOpenChest(child)
  218.                 end
  219.             end)
  220.         end
  221.  
  222.         Toggles['CHESTS_AUTOFARM']:OnChanged(function()
  223.             local bool = Toggles['CHESTS_AUTOFARM'].Value
  224.             print(bool)
  225.             if bool then
  226.                for _, chestHolder in chestSpawnsWs:GetChildren() do
  227.                     local chestModel = chestHolder:FindFirstChild('Chest')
  228.                     if not chestModel then continue end
  229.                     if not chestModel.Box.ChestPrompt.Enabled then continue end
  230.                     attemptOpenChest(chestModel)
  231.                     task.wait(.02)
  232.                end
  233.             else
  234.             end
  235.         end)
  236.     end
  237.  
  238. end
  239. do -- [[ TELEPORTS ]] --
  240.     function initTeleportsGui()
  241.         local types = {
  242.             ['TP_SHRINES'] = function(callback) player.Character:PivotTo(shrinesWs:FindFirstChild(callback).WorldPivot * CFrame.new(0,10,0)) end,
  243.             ['TP_SHOPS'] = function(callback) player.Character:PivotTo(shopsWs:FindFirstChild(callback).WorldPivot) end
  244.         }
  245.  
  246.         for type, func in types do
  247.             Options[type]:OnChanged(function()
  248.                 if Options[type].Value == nil or Options[type].Value == '' then return end
  249.                 local s,e = pcall(function()
  250.                     types[type](Options[type].Value)
  251.                 end)
  252.                 if e then warn(e) end
  253.             end)
  254.         end
  255.  
  256.     end
  257. end
  258. do -- [[ SPOOFERS ]]
  259.  
  260.     function initAntiAdonis()
  261.         if getgenv().adonisACcustom then return end
  262.  
  263.         local function bypass()
  264.             local isLoaded = false
  265.             for _, v in getgc(true) do
  266.                 if typeof(v) ~= 'table' then continue end
  267.  
  268.                 if rawget(v, 'indexInstance') then
  269.                     for method, tbl in pairs(v) do
  270.                         pcall(function()
  271.                             if isexecutorclosure(tbl[2]) then return end
  272.                             if iscclosure(tbl[2]) then return end
  273.                             isLoaded = true
  274.                             tbl[2] = function() return false end
  275.                         end)
  276.                     end
  277.                 end
  278.             end
  279.  
  280.             if isLoaded then
  281.                 return true
  282.             else
  283.                 return false
  284.             end
  285.         end
  286.  
  287.         -- Incase adonis takes some time to load.
  288.  
  289.         repeat
  290.             local result = bypass()
  291.             task.wait(3)
  292.         until result or getgenv().adonisACcustom
  293.  
  294.  
  295.         getgenv().adonisACcustom = true
  296.         warn('Adonis Finalized')
  297.     end
  298.  
  299.     function initSpoofRemotes()
  300.  
  301.         local remoteEventAssociations = {
  302.             ['damage'] = function(instance, args)
  303.                 return nil
  304.             end,
  305.         }
  306.  
  307.         local old;old = hookmetamethod(game, "__namecall", function(self, ...)
  308.             local args = {...}
  309.             if self == receiveDamageRm then
  310.                 print(getnamecallmethod())
  311.             end
  312.             if getnamecallmethod() == "FireServer" and self == receiveDamageRm then
  313.                 print('DAMAGE CALLED')
  314.                 if args[1] == player.Character then
  315.                     print('DAMAGE PREVENTED')
  316.                     return nil
  317.                 end
  318.             end
  319.  
  320.             return old(self, ...)
  321.         end)
  322.  
  323.     end
  324.  
  325. end
  326. do -- [[ CLEAN UP ]]
  327.     function cleanConnections()
  328.         for key, con in connections do
  329.             con:Disconnect()
  330.             connections[key] = nil
  331.         end
  332.         table.clear(connections)
  333.     end
  334. end
  335.  
  336. -- // GUI
  337.  
  338. local repo = 'https://raw.githubusercontent.com/mrchigurh/LinoriaLib/main/'
  339. local Library = loadstring(game:HttpGet(repo .. 'Library.lua'))()
  340. local ThemeManager = loadstring(game:HttpGet(repo .. 'addons/ThemeManager.lua'))()
  341. local SaveManager = loadstring(game:HttpGet(repo .. 'addons/SaveManager.lua'))()
  342. local Window = Library:CreateWindow({
  343.     Title = 'Critical Revengeance | V1',
  344.     Center = true,
  345.     AutoShow = true,
  346. })
  347. local Tabs = {
  348.  
  349.     ['Main'] = Window:AddTab('Main'),
  350.     ['Settings'] = Window:AddTab('Settings'),
  351.     ['UI Settings'] = Window:AddTab('UI Settings')
  352.  
  353. }
  354.  
  355. do -- [[ Mobs Autofarm Groupbox ]]
  356.     local Groupbox = Tabs.Main:AddLeftGroupbox('Mobs Autofarm (not finished/buggy)')
  357.     Groupbox:AddToggle('MOBS_AUTOFARM', {
  358.         Text = 'Mobs Autofarm',
  359.         Default = false, -- Default value (true / false)
  360.         Tooltip = 'Will begin autofarming mobs.', -- Information shown when you hover over the toggle
  361.     })
  362.     Groupbox:AddDropdown('MOBS_WHITELIST', {
  363.         Values = getAllMobTypes(),
  364.         Default = 0, -- number index of the value / string
  365.         Multi = true, -- true / false, allows multiple choices to be selected
  366.         Compact = true,
  367.         Text = 'Mobs Whitelist',
  368.         Tooltip = 'Mobs Whitelist. Select none for all.', -- Information shown when you hover over the dropdown
  369.     })
  370.  
  371. end
  372.  
  373. do -- [[ Ores Autofarm Groupbox ]]
  374.     local Groupbox = Tabs.Main:AddLeftGroupbox('Ores Autofarm')
  375.     Groupbox:AddToggle('ORES_AUTOFARM', {
  376.         Text = 'Ores Autofarm',
  377.         Default = false, -- Default value (true / false)
  378.         Tooltip = 'Will begin autofarming ores.', -- Information shown when you hover over the toggle
  379.     })
  380.  
  381.     Groupbox:AddDropdown('ORES_DROPDOWN', {
  382.         Values = { 'Copper', 'Gold', 'Silver', 'Titanium', 'Uranium' },
  383.         Default = 1, -- number index of the value / string
  384.         Multi = true, -- true / false, allows multiple choices to be selected
  385.  
  386.         Text = 'Ores Whitelist',
  387.         Tooltip = 'Select the ores you want to automine.', -- Information shown when you hover over the dropdown
  388.     })
  389.  
  390. end
  391.  
  392. do -- [[ Chests Autofarm Groupbox ]]
  393.     local Groupbox = Tabs.Main:AddLeftGroupbox('Chests Autofarm')
  394.     Groupbox:AddToggle('CHESTS_AUTOFARM', {
  395.         Text = 'Chests Autofarm',
  396.         Default = false, -- Default value (true / false)
  397.         Tooltip = 'Will begin autofarming chests.', -- Information shown when you hover over the toggle
  398.     })
  399. end
  400.  
  401. do -- [[ Teleports Groupbox ]]
  402.     local Groupbox = Tabs.Main:AddRightGroupbox('Teleports')
  403.     Groupbox:AddDropdown('TP_SHRINES', {
  404.         Values = getInstanceChildrenAsArray(shrinesWs),
  405.         Default = 0, -- number index of the value / string
  406.         Multi = false, -- true / false, allows multiple choices to be selected
  407.  
  408.         Text = 'Shrines',
  409.     })
  410.     Groupbox:AddDropdown('TP_SHOPS', {
  411.         Values = getInstanceChildrenAsArray(shopsWs, 'Model', {'MM BMarket Shop', 'BMarket Shop'}),
  412.         Default = 0, -- number index of the value / string
  413.         Multi = false, -- true / false, allows multiple choices to be selected
  414.  
  415.         Text = 'Shops',
  416.     })
  417. end
  418.  
  419.  
  420. do -- [[ Final Load ]]
  421.     Library:OnUnload(function()
  422.         print('Unloaded!')
  423.         Library.Unloaded = true
  424.     end)
  425.  
  426.     local MenuGroup = Tabs['UI Settings']:AddLeftGroupbox('Menu')
  427.     MenuGroup:AddButton('Unload', function() Library:Unload() end)
  428.     MenuGroup:AddLabel('Menu bind'):AddKeyPicker('MenuKeybind', { Default = 'LeftAlt', NoUI = true, Text = 'Menu keybind' })
  429.     ThemeManager:SetLibrary(Library)
  430.     SaveManager:SetLibrary(Library)
  431.     SaveManager:IgnoreThemeSettings()
  432.     SaveManager:SetIgnoreIndexes({ 'MenuKeybind' })
  433.     ThemeManager:SetFolder('linoria_lib')
  434.     SaveManager:SetFolder('linoria_lib/Critical_Revengeance')
  435.     SaveManager:BuildConfigSection(Tabs['UI Settings'])
  436.     ThemeManager:ApplyToTab(Tabs['UI Settings'])
  437.     SaveManager:LoadAutoloadConfig()
  438.     Library.ToggleKeybind = Options.MenuKeybind
  439. end
  440.  
  441. -- // MAIN
  442.  
  443. task.defer(function()
  444.     initAntiAdonis()
  445. end)
  446. cleanConnections()
  447. initTeleportsGui()
  448. initMobAutoFarm()
  449. initOreAutoFarm()
  450. initChestAutoFarm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement