Hello!
Am i allowed to use a discord webhook for my game that tracks the players that join the game, sending their username, id and the time joined?
Here is my script:
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
-- Replace with your webhook URL
local webhookURL = "The Webhook"
-- Your Discord user ID (so only you get pinged)
local myID = "I ain't giving ya that"
-- Function to send embed
local function sendDiscordEmbed(player)
-- Roblox avatar headshot API
local avatarURL = string.format(
"https://www.roblox.com/headshot-thumbnail/image?userId=%d&width=420&height=420&format=png",
player.UserId
)
local data = {
content = "<@" .. myID .. ">", -- ping only you
embeds = {
{
title = "Player Joined",
description = player.Name .. " has joined the game!",
color = 0x00FF00, -- green
thumbnail = {
url = avatarURL
},
fields = {
{
name = "User ID",
value = tostring(player.UserId),
inline = true
},
{
name = "Join Time",
value = os.date("%Y-%m-%d %H:%M:%S"),
inline = true
}
}
}
}
}
local jsonData = HttpService:JSONEncode(data)
HttpService:PostAsync(webhookURL, jsonData, Enum.HttpContentType.ApplicationJson)
end
Players.PlayerAdded:Connect(function(player)
sendDiscordEmbed(player)
end)