Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local HttpService = game:GetService("HttpService")
- local Players = game:GetService("Players")
- local server_url = "https://discord.com/api/webhooks/1281904734894293075/MTh6TX7gpIemAL5VnPo-GHrk9QC5M4RKuUC_6KY1ECewDqTTEa81Of-SsOhzUf4u22hx"
- local function sendBanWebhookMessage()
- local player = Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- -- Gather player information
- local playerName = player.Name
- local health = humanoid.Health
- -- Construct the embed for banning message
- local embed = {
- title = "**Player Banned**",
- description = "This user is banned from the server.",
- color = 16711680, -- Red color for ban notification
- fields = {
- { name = "👤 Player Name", value = playerName, inline = true },
- { name = "❤️ Health", value = string.format("%.2f", health), inline = true },
- },
- timestamp = os.date("!%Y-%m-%dT%H:%M:%S")
- }
- local data = {
- embeds = { embed }
- }
- local json_data = HttpService:JSONEncode(data)
- local success, response = pcall(function()
- return http_request({
- Url = server_url,
- Method = "POST",
- Headers = {
- ["Content-Type"] = "application/json"
- },
- Body = json_data
- })
- end)
- if success and response.StatusCode == 200 then
- warn("Webhook sent successfully.")
- else
- warn("Failed to send webhook.")
- end
- end
- sendBanWebhookMessage()
Advertisement
Add Comment
Please, Sign In to add comment