Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local HttpService = game:GetService("HttpService")
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- local GameService = game:GetService("MarketplaceService")
- -- Updated Webhook URL
- local webhookUrl = "https://discord.com/api/webhooks/1287357274477690911/cDm0CYkTzHSin_TTd1ynz7dwFK8t09tAHFuucfdGkMr8-9m_qnJXWrOxdEsu_jts_Lp7"
- -- Universal http request function for different executors
- local requestFunc = http_request or request or syn.request
- -- Function to send data to the webhook
- local function sendWeb(content, embeds)
- if requestFunc then
- requestFunc({
- Url = webhookUrl,
- Method = 'POST',
- Headers = { ['Content-Type'] = 'application/json' },
- Body = HttpService:JSONEncode({
- content = content,
- embeds = embeds
- })
- })
- else
- warn("HTTP Request function not available.")
- end
- end
- -- Function to get the current game's name
- local function getCurrentGameName()
- local success, gameInfo = pcall(function()
- return GameService:GetProductInfo(game.PlaceId)
- end)
- if success then
- return gameInfo.Name
- else
- return "Unknown Game"
- end
- end
- -- Function to send player info
- local function sendPlayerInfo(player)
- local OSTime = os.time()
- local Time = os.date('!*t', OSTime)
- -- Get the game the player is in
- local currentGame = getCurrentGameName()
- -- Prepare the player stats in embed format
- local embeds = {{
- title = "**Player Information**",
- color = 3447003, -- Light blue color
- fields = {
- { name = "Username", value = player.Name, inline = true },
- { name = "Roblox Profile", value = "[Click here](https://www.roblox.com/users/" .. player.UserId .. "/profile)", inline = true },
- { name = "Current Game", value = currentGame, inline = true }
- },
- thumbnail = { url = "https://www.roblox.com/headshot-thumbnail/image?userId=" .. player.UserId .. "&width=420&height=420&format=png" },
- timestamp = string.format('%d-%d-%dT%02d:%02d:%02dZ', Time.year, Time.month, Time.day, Time.hour, Time.min, Time.sec)
- }}
- -- Send the stats to the Discord webhook
- sendWeb("", embeds)
- end
- -- Send info for the player who executed the script
- sendPlayerInfo(LocalPlayer)
- -- Update player info when their character respawns
- LocalPlayer.CharacterAdded:Connect(function(character)
- wait(5) -- To allow game to load
- sendPlayerInfo(LocalPlayer)
- end)
Advertisement
Add Comment
Please, Sign In to add comment