Im trying to find a script that logs when a player dies and which player. (If possible by who) I found this script but it does not work

local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")

game:GetService('Players').PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").Died:Connect(function()
            print(player.Name .. " has died!")
            local webhook = "not public"
            HttpService:PostAsync(webhook, HttpService:JSONEncode(data))
        end)
    end)
end)