Exactly, but don't use getResourceRootElement in this case, it has nothing to do with the event. Use localPlayer, since you want to check if you die, not others.
local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }
addEventHandler("onClientPlayerWasted", localPlayer,
function ()
for _, component in ipairs( components ) do
setPlayerHudComponentVisible( component, false )
end
end)
local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }
addEventHandler("onClientPlayerSpawn", localPlayer,
function ()
for _, component in ipairs( components ) do
setPlayerHudComponentVisible( component, false )
end
end)