[Help]revive script

hi guys
i woork on a revive script only problem i have now if i use heal on a dead guy he cant press start or esc key nothing open
did i miss something on my code?

local ped = GetPlayerPed(-1)
RegisterNetEvent('es_heal:heal')
AddEventHandler('es_heal:heal', function()
	--AddArmourToPed(GetPlayerPed(-1), 100)
	SetPedMaxHealth(GetPlayerPed(-1), 200)
	SetEntityHealth(GetPlayerPed(-1), 1000)
	ClearPedTasksImmediately(ped)
	ClearPedBloodDamage(GetPlayerPed(-1))
    ClearPedLastDamageBone(GetPlayerPed(-1))
end)

Why are you clearing tasks?

if not IsEntityDead(ped) then
    SetPedMaxHealth(ped, 200)
    SetEntityHealth(ped, 1000) -- seems odd
    ClearPedBloodDamage(ped)
    ClearPedLastDamageBone(ped)
    ResetPedVisibleDamage(ped)
    ClearPedLastWeaponDamage(ped)		
    RemoveParticleFxFromEntity(ped)	
end

and you should really do a google search of

site:fivem.net heal

it gives you a bunch of answers

oh well script work only prob is that player i revive cant use esc key 2 open map or anything so i must miss something thanks for help anyway

yes don’t heal a dead guy. you need to repawn or a revive script.

this script uses

NetworkResurrectLocalPlayer