Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PlaceId = 292439477
- if game.PlaceId ~= PlaceId then
- return
- elseif not game:IsLoaded() then
- game.Loaded:Wait()
- end
- local Players = game:GetService("Players")
- local HttpService = game:GetService("HttpService")
- local TeleportService = game:GetService("TeleportService")
- local LocalPlayer = Players.LocalPlayer
- local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
- local ChatGame = PlayerGui:WaitForChild("ChatGame")
- local Votekick = ChatGame:WaitForChild("Votekick")
- local Title = Votekick:WaitForChild("Title")
- local Boolean, JobIds = pcall(readfile, "JobIds.json")
- if not Boolean then
- writefile("JobIds.json", HttpService:JSONEncode({}))
- JobIds = HttpService:JSONDecode(readfile("JobIds.json"))
- else
- JobIds = HttpService:JSONDecode(JobIds)
- end
- local GetRandomJobId = function()
- local JSONDecode = HttpService:JSONDecode(syn.request({
- Url = string.format("https://games.roblox.com/v1/games/%s/servers/Public?sortOrder=Asc&limit=100", tostring(PlaceId)),
- Method = "GET"
- }).Body)
- local Number = 0
- local JobId = JSONDecode.data[math.random(1, table.getn(JSONDecode.data))].id
- if table.find(JobIds, JobId) then
- repeat
- Number = math.random(1, table.getn(JSONDecode.data))
- JobId = JSONDecode.data[Number].id
- task.wait()
- until not table.find(JobIds, JobId) and JSONDecode.data[Number].playing < JSONDecode.data[Number].maxPlayers
- return JobId
- else
- return JobId
- end
- end
- Title:GetPropertyChangedSignal("Text"):Connect(function()
- if string.find(Title.Text, LocalPlayer.Name) then
- table.insert(JobIds, game.JobId)
- writefile("JobIds.json", HttpService:JSONEncode(JobIds))
- TeleportService:TeleportToPlaceInstance(PlaceId, GetRandomJobId())
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement