“Hotkey logger a roblox script to log player movements hotkeys pressed, including the time they were pressed with the data sent to a webhook.”
HTTPS requesta are on and I find the script challenging to work with for my ingame moderation; I do not like how number 1, the data is not being sent to said webhook (not included for obvious reasons) 2, I cannot confirm which player presses which key. I want it so if player 1 presses A key, and player 2 presses A key, lets say theres a coincedence and they press it at the same time. I want to tell them apart via username. I’ve worked with scripts sending data via roblox to webhook and this is the first time I’ve really had challenges with it. Feedback and tweaks to code appreciated
-- Hotkey Logger: A Roblox script to log player movements and hotkeys pressed, including timestamps, to a webhook.
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
local webhookURL = "YOUR_WEBHOOK_URL_HERE"
local function sendLog(message)
local payload = HttpService:JSONEncode({content = message})
HttpService:PostAsync(webhookURL, payload, Enum.HttpContentType.ApplicationJson)
end
local function logMovement(player, key)
local timestamp = os.date("%Y-%m-%d %H:%M:%S")
local message = player.Name .. " pressed " .. key .. " at " .. timestamp
sendLog(message)
end
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
if message:lower() == "/logkeys" then
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local playerInput = game:GetService("UserInputService")
playerInput.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then
logMovement(player, input.KeyCode.Name)
end
end)
end
end)
end)