Let's get this through:
function Blip (player)
The function has no ending (supposed to be at line 10)
local myplayer = localPlayer()
The "function" localPlayer is not a function (that makes the line actually pointless) and then the variable exists only clientside - I assume that it's a serverside script because you used onPlayerWasted
local x, y, z = getElementPosition( myPlayer )
blip = createBlip( x, y, z, 20, myPlayer )
setElementParent( blip, myPlayer )
These lines will fail by default, because your variable "myplayer" is nil (use your parameter "player" instead)
function destroyBlipAttachedTo ( player ) ... end
addEventHandler( "onPlayerWasted", getRootElement(), destroyBlipAttachedTo)
The event OnPlayerWasted actually gives you "totalAmmo" as first parameter (you used it as player). Delete it and use the hidden variable "source" for the player element.