UsernameRTX

Phantom Forces Votekick Auto-Rejoin

Jul 20th, 2021 (edited)
14,310
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local PlaceId = 292439477
  2. if game.PlaceId ~= PlaceId then
  3.     return
  4. elseif not game:IsLoaded() then
  5.     game.Loaded:Wait()
  6. end
  7.  
  8. local Players = game:GetService("Players")
  9. local HttpService = game:GetService("HttpService")
  10. local TeleportService = game:GetService("TeleportService")
  11.  
  12. local LocalPlayer = Players.LocalPlayer
  13.  
  14. local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
  15.  
  16. local ChatGame = PlayerGui:WaitForChild("ChatGame")
  17.  
  18. local Votekick = ChatGame:WaitForChild("Votekick")
  19.  
  20. local Title = Votekick:WaitForChild("Title")
  21.  
  22. local Boolean, JobIds = pcall(readfile, "JobIds.json")
  23. if not Boolean then
  24.     writefile("JobIds.json", HttpService:JSONEncode({}))
  25.     JobIds = HttpService:JSONDecode(readfile("JobIds.json"))
  26. else
  27.     JobIds = HttpService:JSONDecode(JobIds)
  28. end
  29.  
  30. local GetRandomJobId = function()
  31.     local JSONDecode = HttpService:JSONDecode(syn.request({
  32.         Url = string.format("https://games.roblox.com/v1/games/%s/servers/Public?sortOrder=Asc&limit=100", tostring(PlaceId)),
  33.         Method = "GET"
  34.     }).Body)
  35.     local JobId = JSONDecode.data[math.random(1, table.getn(JSONDecode.data))].id
  36.     if table.find(JobIds, JobId) then
  37.         repeat
  38.             JobId = JSONDecode.data[math.random(1, table.getn(JSONDecode.data))].id
  39.         until not table.find(JobIds, JobId)
  40.         return JobId
  41.     else
  42.         return JobId
  43.     end
  44. end
  45.  
  46. Title:GetPropertyChangedSignal("Text"):Connect(function()
  47.     if string.find(Title.Text, LocalPlayer.Name) then
  48.         table.insert(JobIds, game.JobId)
  49.         writefile("JobIds.json", HttpService:JSONEncode(JobIds))
  50.         TeleportService:TeleportToPlaceInstance(PlaceId, GetRandomJobId())
  51.     end
  52. end)
RAW Paste Data