Advertisement
Guest User

gravity controller

a guest
Feb 2nd, 2020
7,771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.52 KB | None | 0 0
  1. getgenv()["cofiG"] = getgenv()["cofiG"] or {}
  2. local hasToUpdate = true
  3. local alreadyRan = cofiG.gravityController ~= nil
  4.  
  5. local http = game:GetService'HttpService'
  6. local readfile,writefile,fileexists = readfile or syn_io_read,writefile or syn_io_write,isfile or readfile
  7.  
  8. local rawUrl,baseUrl = "https://ixss.keybase.pub/rblx/gravityController/", "https://keybase.pub/ixss/rblx/gravityController/"
  9.  
  10. do
  11. _G.req = [[
  12. local require = function(lol)
  13. lol = "https://raw.githubusercontent.com/msva/lua-htmlparser/master/src/"..lol:gsub("%.","/")..".lua";
  14. return loadstring(_G.req..game:HttpGet(lol))();
  15. end;
  16. ]]
  17.  
  18. local require = function(lol)
  19. lol = "https://raw.githubusercontent.com/msva/lua-htmlparser/master/src/"..lol:gsub("%.","/")..".lua";
  20. return loadstring(_G.req..game:HttpGet(lol))();
  21. end;
  22.  
  23. cofiG.htmlparser = cofiG.htmlparser or require"htmlparser"
  24. end
  25.  
  26. do -- check if exists
  27. if fileexists'gravityController.json' then
  28. local json = readfile'gravityController.json'
  29. if json then
  30. cofiG.gravityController = http:JSONDecode(json)
  31. hasToUpdate = cofiG.gravityController.Version ~= game:HttpGet(rawUrl.."Version.txt")
  32. end
  33. end
  34. end
  35.  
  36.  
  37. if hasToUpdate then -- update/download
  38.  
  39. function getScripts()
  40. local ret = {}
  41. local text = game:HttpGet(baseUrl, false)
  42.  
  43. local root = cofiG.htmlparser.parse(text)
  44. local files = root:select(".file")
  45.  
  46. for i,v in pairs(files) do
  47. if string.sub(v.attributes.href, string.len(v.attributes.href)-3) == ".lua" then
  48. local name = string.sub(v.attributes.href,string.len(baseUrl)+1, string.len(v.attributes.href)-4)
  49. local script = rawUrl..name..".lua"
  50. ret[name] = game:HttpGet(script)
  51. elseif string.sub(v.attributes.href, string.len(v.attributes.href)-3) == ".txt" then
  52. local name = string.sub(v.attributes.href,string.len(baseUrl)+1, string.len(v.attributes.href)-4)
  53. local script = rawUrl..name..".txt"
  54. ret[name] = game:HttpGet(script)
  55. end
  56. end
  57.  
  58. return ret
  59. end
  60. cofiG.gravityController = getScripts()
  61. writefile('gravityController.json', http:JSONEncode(cofiG.gravityController))
  62. warn('Script updated!')
  63. end
  64.  
  65. local a,b = pcall(loadstring(cofiG.gravityController.Loader))
  66.  
  67. if not a then
  68. error('Loader ', b)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement