Thunder_beast

Hook

Sep 27th, 2024
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.56 KB | None | 0 0
  1. local HttpService = game:GetService("HttpService")
  2. local Players = game:GetService("Players")
  3. local LocalPlayer = Players.LocalPlayer
  4. local GameService = game:GetService("MarketplaceService")
  5.  
  6. -- Updated Webhook URL
  7. local webhookUrl = "https://discord.com/api/webhooks/1287357274477690911/cDm0CYkTzHSin_TTd1ynz7dwFK8t09tAHFuucfdGkMr8-9m_qnJXWrOxdEsu_jts_Lp7"
  8.  
  9. -- Universal http request function for different executors
  10. local requestFunc = http_request or request or syn.request
  11.  
  12. -- Function to send data to the webhook
  13. local function sendWeb(content, embeds)
  14.     if requestFunc then
  15.         requestFunc({
  16.             Url = webhookUrl,
  17.             Method = 'POST',
  18.             Headers = { ['Content-Type'] = 'application/json' },
  19.             Body = HttpService:JSONEncode({
  20.                 content = content,
  21.                 embeds = embeds
  22.             })
  23.         })
  24.     else
  25.         warn("HTTP Request function not available.")
  26.     end
  27. end
  28.  
  29. -- Function to get the current game's name
  30. local function getCurrentGameName()
  31.     local success, gameInfo = pcall(function()
  32.         return GameService:GetProductInfo(game.PlaceId)
  33.     end)
  34.    
  35.     if success then
  36.         return gameInfo.Name
  37.     else
  38.         return "Unknown Game"
  39.     end
  40. end
  41.  
  42. -- Function to send player info
  43. local function sendPlayerInfo(player)
  44.     local OSTime = os.time()
  45.     local Time = os.date('!*t', OSTime)
  46.  
  47.     -- Get the game the player is in
  48.     local currentGame = getCurrentGameName()
  49.  
  50.     -- Prepare the player stats in embed format
  51.     local embeds = {{
  52.         title = "**Player Information**",
  53.         color = 3447003,  -- Light blue color
  54.         fields = {
  55.             { name = "Username", value = player.Name, inline = true },
  56.             { name = "Roblox Profile", value = "[Click here](https://www.roblox.com/users/" .. player.UserId .. "/profile)", inline = true },
  57.             { name = "Current Game", value = currentGame, inline = true }
  58.         },
  59.         thumbnail = { url = "https://www.roblox.com/headshot-thumbnail/image?userId=" .. player.UserId .. "&width=420&height=420&format=png" },
  60.         timestamp = string.format('%d-%d-%dT%02d:%02d:%02dZ', Time.year, Time.month, Time.day, Time.hour, Time.min, Time.sec)
  61.     }}
  62.  
  63.     -- Send the stats to the Discord webhook
  64.     sendWeb("", embeds)
  65. end
  66.  
  67. -- Send info for the player who executed the script
  68. sendPlayerInfo(LocalPlayer)
  69.  
  70. -- Update player info when their character respawns
  71. LocalPlayer.CharacterAdded:Connect(function(character)
  72.     wait(5) -- To allow game to load
  73.     sendPlayerInfo(LocalPlayer)
  74. end)
Advertisement
Add Comment
Please, Sign In to add comment