Spawn protection when scatering players [closed]

I have a mini game that spawns players in random locations when they die. I was wondering if there was a way to make them invincible for 5 seconds.


you can give the players resistance 255 for five seconds using the following command:

/effect @a minecraft:resistance 5 255 true

First you need to type /scoreboard objektives add (name) deathCount in chat. Then you put a repeat and always active command block facing uppwards with... testfor @a[score_(objective name) min=1] And then you put a chain, conditional and always active command block on top of the other one, with... effect @a[score_(objective name)min=1] minecraft:resistance 5 255 true And the at the top of the chain command block you put another chain, conditional and always active command block with... scoreboard players set @a[score(objective name)_min=1] (objective name) 1

Thats all I know:-)