Advertisement
suramraja1

flxs

Mar 16th, 2024 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.67 KB | None | 0 0
  1.  
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3. local LocalPlayer = game:GetService("Players").LocalPlayer
  4. local Workspace = game:GetService("Workspace")
  5.  
  6. local map
  7. local PlaceId = game.PlaceId
  8. if PlaceId == 8737899170 then
  9.     map = Workspace.Map
  10. elseif PlaceId == 16498369169 then
  11.     map = Workspace.Map2
  12. end
  13.  
  14. local unfinished = true
  15. local currentZone
  16.  
  17. require(ReplicatedStorage.Library.Client.PlayerPet).CalculateSpeedMultiplier = function(...)
  18.     return 200
  19. end
  20.  
  21. local function teleportToMaxZone()
  22.     local zoneName, maxZoneData = require(ReplicatedStorage.Library.Client.ZoneCmds).GetMaxOwnedZone()
  23.     while currentZone == zoneName do
  24.         zoneName, maxZoneData = require(ReplicatedStorage.Library.Client.ZoneCmds).GetMaxOwnedZone()
  25.         task.wait()
  26.     end
  27.     currentZone = zoneName
  28.     print("Teleporting to zone: " .. zoneName)
  29.  
  30.     local zonePath
  31.     for _, v in pairs(map:GetChildren()) do
  32.         if string.find(v.Name, tostring(maxZoneData.ZoneNumber) .. " | " .. zoneName) then
  33.             zonePath = v
  34.         end
  35.     end
  36.     LocalPlayer.Character.HumanoidRootPart.CFrame = zonePath:WaitForChild("PERSISTENT").Teleport.CFrame + Vector3.new(0, 10, 0)
  37.     task.wait()
  38.  
  39.     if not zonePath:FindFirstChild("INTERACT") then
  40.         local loaded = false
  41.         local detectLoad = zonePath.ChildAdded:Connect(function(child)
  42.             if child.Name == "INTERACT" then
  43.                 loaded = true
  44.             end
  45.         end)
  46.  
  47.         repeat
  48.             task.wait()
  49.         until loaded
  50.  
  51.         detectLoad:Disconnect()
  52.     end
  53.  
  54.     local dist = 999
  55.     local closestBreakZone = nil
  56.     for _, v in pairs(zonePath.INTERACT.BREAK_ZONES:GetChildren()) do
  57.         local magnitude = (LocalPlayer.Character.HumanoidRootPart.Position - v.Position).Magnitude
  58.         if magnitude <= dist then
  59.             dist = magnitude
  60.             closestBreakZone = v
  61.         end
  62.     end
  63.  
  64.     LocalPlayer.Character.HumanoidRootPart.CFrame = closestBreakZone.CFrame + Vector3.new(0, 10, 0)
  65.  
  66.     if maxZoneData.ZoneNumber >= getgenv().autoWorldConfig.ZONE_TO_REACH then
  67.         print("Reached selected zone")
  68.         unfinished = false
  69.     end
  70. end
  71.  
  72. for _, lootbag in pairs(Workspace.__THINGS:FindFirstChild("Lootbags"):GetChildren()) do
  73.     if lootbag then
  74.         ReplicatedStorage.Network:WaitForChild("Lootbags_Claim"):FireServer(unpack( { [1] = { [1] = lootbag.Name, }, } ))
  75.         lootbag:Destroy()
  76.         task.wait()
  77.     end
  78. end
  79.  
  80. Workspace.__THINGS:FindFirstChild("Lootbags").ChildAdded:Connect(function(lootbag)
  81.     task.wait()
  82.     if lootbag then
  83.         ReplicatedStorage.Network:WaitForChild("Lootbags_Claim"):FireServer(unpack( { [1] = { [1] = lootbag.Name, }, } ))
  84.         lootbag:Destroy()
  85.     end
  86. end)
  87.  
  88. Workspace.__THINGS:FindFirstChild("Orbs").ChildAdded:Connect(function(orb)
  89.     task.wait()
  90.     if orb then
  91.         ReplicatedStorage.Network:FindFirstChild("Orbs: Collect"):FireServer(unpack( { [1] = { [1] = tonumber(orb.Name), }, } ))
  92.         orb:Destroy()
  93.     end
  94. end)
  95.  
  96.  
  97. local nextRebirthData = require(game:GetService("ReplicatedStorage").Library.Client.RebirthCmds).GetNextRebirth()
  98. local rebirthNumber
  99. local rebirthZone
  100.  
  101. if nextRebirthData then
  102.     rebirthNumber = nextRebirthData.RebirthNumber
  103.     rebirthZone = nextRebirthData.ZoneNumberRequired
  104. end
  105.  
  106. task.spawn(function()
  107.     print("Starting zone purchase service")
  108.     while unfinished do
  109.         local nextZoneName, nextZoneData = require(game:GetService("ReplicatedStorage").Library.Client.ZoneCmds).GetNextZone()
  110.         local success, _ = game:GetService("ReplicatedStorage").Network.Zones_RequestPurchase:InvokeServer(nextZoneName)
  111.         if success then
  112.             print("Successfully purchased " .. nextZoneName)
  113.             if getgenv().autoWorldConfig.AUTO_REBIRTH then
  114.                 pcall(function()
  115.                     if nextZoneData.ZoneNumber >= rebirthZone then
  116.                         print("Rebirthing")
  117.                         game:GetService("ReplicatedStorage").Network.Rebirth_Request:InvokeServer(tostring(rebirthNumber))
  118.                         task.wait(15)
  119.                         nextRebirthData = require(game:GetService("ReplicatedStorage").Library.Client.RebirthCmds).GetNextRebirth()
  120.                         if nextRebirthData then
  121.                             rebirthNumber = nextRebirthData.RebirthNumber
  122.                             rebirthZone = nextRebirthData.ZoneNumberRequired
  123.                         end
  124.                     end
  125.                 end)
  126.             end
  127.             teleportToMaxZone()
  128.         end
  129.         task.wait(getgenv().autoWorldConfig.PURCHASE_CHECK_DELAY)
  130.     end
  131. end)
  132.  
  133. teleportToMaxZone()
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement