Advertisement
GaryScripts

HTTPService with Discord Webhook API Example

Nov 25th, 2021
1,032
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local url = "" --webhook url here
  2. local HTTP = game:GetService("HttpService")
  3.  
  4. game.Players.PlayerAdded:Connect(function(plr)
  5.     local data = {
  6.         ["embeds"] = {{
  7.             ["author"] = {
  8.                 ['name'] = plr.Name,
  9.                 ['icon_url'] = "https://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&username="..plr.Name
  10.             },
  11.            
  12.             ["description"] = plr.Name.." has joined the game.",
  13.             ["color"] = 786176,
  14.             ["url"] = "https://www.roblox.com/users/"..plr.UserId.."/profile",
  15.            
  16.             ["fields"] = {
  17.                 {
  18.                     ['name'] = "Account Age",
  19.                     ['value'] = tostring(plr.AccountAge),
  20.                     ['inline'] = true
  21.                 },
  22.                
  23.                 {
  24.                     ['name'] = "User ID",
  25.                     ['value'] = tostring(plr.UserId),
  26.                     ['inline'] = true
  27.                 }
  28.             }
  29.         }}
  30.     }
  31.    
  32.     data = HTTP:JSONEncode(data)
  33.     HTTP:PostAsync(url, data)
  34. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement