Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _G.chooseitem = "XSoul"
- TimeToTp = 5 --SET AMOUNT OF SECONDS YOU WANT TO TP AFTER
- local PlaceID = game.PlaceId
- local AllIDs = {}
- local foundAnything = ""
- local actualHour = os.date("!*t").hour
- local Deleted = false
- local File = pcall(function()
- AllIDs = game:GetService('HttpService'):JSONDecode(readfile("NotSameServers.json"))
- end)
- if not File then
- table.insert(AllIDs, actualHour)
- writefile("NotSameServers.json", game:GetService('HttpService'):JSONEncode(AllIDs))
- end
- function TPReturner()
- local Site;
- if foundAnything == "" then
- Site = game.HttpService:JSONDecode(game:HttpGet('https://games.roblox.com/v1/games/' .. PlaceID .. '/servers/Public?sortOrder=Asc&limit=100'))
- else
- Site = game.HttpService:JSONDecode(game:HttpGet('https://games.roblox.com/v1/games/' .. PlaceID .. '/servers/Public?sortOrder=Asc&limit=100&cursor=' .. foundAnything))
- end
- local ID = ""
- if Site.nextPageCursor and Site.nextPageCursor ~= "null" and Site.nextPageCursor ~= nil then
- foundAnything = Site.nextPageCursor
- end
- local num = 0;
- for i,v in pairs(Site.data) do
- local Possible = true
- ID = tostring(v.id)
- if tonumber(v.maxPlayers) > tonumber(v.playing) then
- for _,Existing in pairs(AllIDs) do
- if num ~= 0 then
- if ID == tostring(Existing) then
- Possible = false
- end
- else
- if tonumber(actualHour) ~= tonumber(Existing) then
- local delFile = pcall(function()
- delfile("NotSameServers.json")
- AllIDs = {}
- table.insert(AllIDs, actualHour)
- end)
- end
- end
- num = num + 1
- end
- if Possible == true then
- table.insert(AllIDs, ID)
- wait()
- pcall(function()
- writefile("NotSameServers.json", game:GetService('HttpService'):JSONEncode(AllIDs))
- wait()
- game:GetService("TeleportService"):TeleportToPlaceInstance(PlaceID, ID, game.Players.LocalPlayer)
- end)
- wait(4)
- end
- end
- end
- end
- function Teleport()
- while wait() do
- pcall(function()
- TPReturner()
- if foundAnything ~= "" then
- TPReturner()
- end
- end)
- end
- end
- local function getCHEST()
- local dist, thing = math.huge
- for i,v in next, game:GetService("Workspace").ItemSpawns["Chests"]:GetDescendants() do
- if v:IsA("Model") and v.Parent.Name == "SpawnLocation" then
- print(i,v)
- local mag =
- (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.RootPart.Position).magnitude
- if mag < dist then
- dist = mag
- thing = v
- end
- end
- end
- return thing
- end
- getCHEST()
- while task.wait() do
- for i,v in pairs(game:GetService("Workspace").ItemSpawns.Chests:GetChildren()) do
- if v.Name == "SpawnLocation" and v:FindFirstChild("Chest") then
- pcall(function()
- game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = v.CFrame
- fireproximityprompt(v.Chest.RootPart.ProximityAttachment.Interaction)
- end)
- if game.Players.LocalPlayer.Backpack:FindFirstChild(_G.chooseitem) then
- game.Players.LocalPlayer.Character.Humanoid:EquipTool(game.Players.LocalPlayer.Backpack[_G.chooseitem])
- wait(1)
- local A_1 = "ItemInventory"
- local A_2 =
- {
- ["AddItems"] = true
- }
- local Event = game:GetService("ReplicatedStorage").Remotes.InventoryRemote
- Event:FireServer(A_1, A_2)
- end
- end
- end
- if getCHEST() == nil then
- print"abc"
- Teleport()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement