META Cosmetic Store & add gold per kill

Okay so, I want to get gold everytime I kill someone in my game Murder Mystery 2. I am using META Cosmetic Store and I got help with a script that is supposed to give me gold everytime I kill someone. But it didn't work, can someone please help me with this? Here's the code for the add gold per kill:
function giveKillerGold(player, damage)
-- player is the person who died
-- we need to give gold to the person who killed them
local killer = damage.sourcePlayer
killer:AddResource("gold", 1)
end

function setUpPlayersGetGold(player)
player.diedEvent:Connect()
-- When the player dies,do the giveKillerGold function
end

Game.playerJoinedEvent:Connect(setUpPlayersGetGold)
-- When a player joins,
-- We set up a connection to their death

You were pretty close, you just forgot to connect the giveKillerGold function to the "diedEvent". Below is the revised code:

function giveKillerGold(player, damage)

    -- player is the person who died

    -- we need to give gold to the person who killed them

    local killer = damage.sourcePlayer

    killer:AddResource("gold", 1)

end

    

function setUpPlayersGetGold(player)

    player.diedEvent:Connect(giveKillerGold)

    -- When the player dies,do the giveKillerGold function

end

Game.playerJoinedEvent:Connect(setUpPlayersGetGold)

-- When a player joins,

-- We set up a connection to their death

¨Thank you! <3

No problem.