Advertisement
karobloxYT

Untitled

Aug 25th, 2022 (edited)
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. _G.chooseitem = "XSoul"
  2. TimeToTp = 5 --SET AMOUNT OF SECONDS YOU WANT TO TP AFTER
  3.  
  4. local PlaceID = game.PlaceId
  5. local AllIDs = {}
  6. local foundAnything = ""
  7. local actualHour = os.date("!*t").hour
  8. local Deleted = false
  9. local File = pcall(function()
  10. AllIDs = game:GetService('HttpService'):JSONDecode(readfile("NotSameServers.json"))
  11. end)
  12. if not File then
  13. table.insert(AllIDs, actualHour)
  14. writefile("NotSameServers.json", game:GetService('HttpService'):JSONEncode(AllIDs))
  15. end
  16. function TPReturner()
  17. local Site;
  18. if foundAnything == "" then
  19. Site = game.HttpService:JSONDecode(game:HttpGet('https://games.roblox.com/v1/games/' .. PlaceID .. '/servers/Public?sortOrder=Asc&limit=100'))
  20. else
  21. Site = game.HttpService:JSONDecode(game:HttpGet('https://games.roblox.com/v1/games/' .. PlaceID .. '/servers/Public?sortOrder=Asc&limit=100&cursor=' .. foundAnything))
  22. end
  23. local ID = ""
  24. if Site.nextPageCursor and Site.nextPageCursor ~= "null" and Site.nextPageCursor ~= nil then
  25. foundAnything = Site.nextPageCursor
  26. end
  27. local num = 0;
  28. for i,v in pairs(Site.data) do
  29. local Possible = true
  30. ID = tostring(v.id)
  31. if tonumber(v.maxPlayers) > tonumber(v.playing) then
  32. for _,Existing in pairs(AllIDs) do
  33. if num ~= 0 then
  34. if ID == tostring(Existing) then
  35. Possible = false
  36. end
  37. else
  38. if tonumber(actualHour) ~= tonumber(Existing) then
  39. local delFile = pcall(function()
  40. delfile("NotSameServers.json")
  41. AllIDs = {}
  42. table.insert(AllIDs, actualHour)
  43. end)
  44. end
  45. end
  46. num = num + 1
  47. end
  48. if Possible == true then
  49. table.insert(AllIDs, ID)
  50. wait()
  51. pcall(function()
  52. writefile("NotSameServers.json", game:GetService('HttpService'):JSONEncode(AllIDs))
  53. wait()
  54. game:GetService("TeleportService"):TeleportToPlaceInstance(PlaceID, ID, game.Players.LocalPlayer)
  55. end)
  56. wait(4)
  57. end
  58. end
  59. end
  60. end
  61.  
  62. function Teleport()
  63. while wait() do
  64. pcall(function()
  65. TPReturner()
  66. if foundAnything ~= "" then
  67. TPReturner()
  68. end
  69. end)
  70. end
  71. end
  72.  
  73.  
  74. local function getCHEST()
  75. local dist, thing = math.huge
  76. for i,v in next, game:GetService("Workspace").ItemSpawns["Chests"]:GetDescendants() do
  77. if v:IsA("Model") and v.Parent.Name == "SpawnLocation" then
  78. print(i,v)
  79. local mag =
  80. (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.RootPart.Position).magnitude
  81. if mag < dist then
  82. dist = mag
  83. thing = v
  84. end
  85. end
  86. end
  87. return thing
  88. end
  89. getCHEST()
  90. while task.wait() do
  91. for i,v in pairs(game:GetService("Workspace").ItemSpawns.Chests:GetChildren()) do
  92. if v.Name == "SpawnLocation" and v:FindFirstChild("Chest") then
  93. pcall(function()
  94. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = v.CFrame
  95. fireproximityprompt(v.Chest.RootPart.ProximityAttachment.Interaction)
  96. end)
  97. if game.Players.LocalPlayer.Backpack:FindFirstChild(_G.chooseitem) then
  98.  
  99. game.Players.LocalPlayer.Character.Humanoid:EquipTool(game.Players.LocalPlayer.Backpack[_G.chooseitem])
  100. wait(1)
  101. local A_1 = "ItemInventory"
  102. local A_2 =
  103. {
  104. ["AddItems"] = true
  105. }
  106. local Event = game:GetService("ReplicatedStorage").Remotes.InventoryRemote
  107. Event:FireServer(A_1, A_2)
  108. end
  109. end
  110. end
  111.  
  112. if getCHEST() == nil then
  113. print"abc"
  114. Teleport()
  115. end
  116. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement