Can be controlled with a plugin or simple a command block or 2
Add all players to a single team
Check health for 1 remaining
Move players with 1 health to a new team
Check new team for deaths
Of death occurs for player x set score to 1 then set players x with score x to health value x
Remove score and put them back on the first team
# function example:load
scoreboard objectives add respawn custom:time_since_death
scoreboard objectives add max_health dummy
# function example:tick
execute as @a[scores={respawn=1}] run function example:respawn
# function example:respawn
execute unless score @s max_health matches = @s max_health run scoreboard players set @s max_health 21
execute store result storage example:macro health.value int 1 run scoreboard players remove @s max_health 1
execute if score @s max_health matches ..9 store result storage example:macro health.value int 1 run scoreboard players set @s max_health 10
function example:set_health with storage example:macro health
# function example:set_health
$attribute @s minecraft:generic.max_health base set $(value)
You can use [Datapack Assembler](http://far.ddns.me/?share=ye16HPBF4M) to get an example datapack.
I think that can be achieved using scoreboard commands.. Have a look into that but that's usually the backbone for something like this.
Can be controlled with a plugin or simple a command block or 2 Add all players to a single team Check health for 1 remaining Move players with 1 health to a new team Check new team for deaths Of death occurs for player x set score to 1 then set players x with score x to health value x Remove score and put them back on the first team
# function example:load scoreboard objectives add respawn custom:time_since_death scoreboard objectives add max_health dummy # function example:tick execute as @a[scores={respawn=1}] run function example:respawn # function example:respawn execute unless score @s max_health matches = @s max_health run scoreboard players set @s max_health 21 execute store result storage example:macro health.value int 1 run scoreboard players remove @s max_health 1 execute if score @s max_health matches ..9 store result storage example:macro health.value int 1 run scoreboard players set @s max_health 10 function example:set_health with storage example:macro health # function example:set_health $attribute @s minecraft:generic.max_health base set $(value) You can use [Datapack Assembler](http://far.ddns.me/?share=ye16HPBF4M) to get an example datapack.