RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"remove the html to rgb, and just make the join colour blue and the leave colour red"
-- roblox script -- server script (ServerScriptService) local HttpService = game:GetService("HttpService") local webhookURL = "Your Webhook URL Here" -- replace with your Discord webhook URL local playerJoinTimes = {} game.Players.PlayerAdded:Connect(function(player) local data = { ["embeds"] = {{ ["title"] = "Player Joined", ["description"] = player.Name .. " (" .. player.UserId .. ") has joined the game.", ["color"] = Color3.new(0, 0, 1), -- blue color ["footer"] = { ["text"] = "Roblox Server" }, ["timestamp"] = os.date("!%Y-%m-%dT%H:%M:%SZ") }}, } playerJoinTimes[player.UserId] = os.time() local success, err = pcall(function() HttpService:PostAsync(webhookURL, HttpService:JSONEncode(data), Enum.HttpContentType.ApplicationJson, false) end) if not success then warn("Failed to send message to Discord: " .. err) end end) game.Players.PlayerRemoving:Connect(function(player) local playTime = os.time() - playerJoinTimes[player.UserId] local data = { ["embeds"] = {{ ["title"] = "Player Left", ["description"] = player.Name .. " (" .. player.UserId .. ") has left the game. They played for " .. playTime .. " seconds.", ["color"] = Color3.new(1, 0, 0), -- red color ["footer"] = { ["text"] = "Roblox Server" }, ["timestamp"] = os.date("!%Y-%m-%dT%H:%M:%SZ") }}, } local success, err = pcall(function() HttpService:PostAsync(webhookURL, HttpService:JSONEncode(data), Enum.HttpContentType.ApplicationJson, false) end) if not success then warn("Failed to send message to Discord: " .. err) end end)