How can I make players spawn with a sword after dying?

How can I make players spawn with a sword after dying? - A Person Holding King of Hearts Card

I am making a bedwars map in Minecraft.

In real bedwars, when a player dies, they keep only their sword.

How can I make it so that players spawn with a wooden sword?



Best Answer

You need a death Counter first

/scoreboard objectives add deaths deathCount

I recommend functions but you can use a repeat command block and a chain command block, too

/execute as @a[scores={deaths=1..}] run give @s minecraft:iron_sword
/execute as @a[scores={deaths=1..}] run scoreboard players reset @s deaths



Pictures about "How can I make players spawn with a sword after dying?"

How can I make players spawn with a sword after dying? - A Card Dealer Holding a Card in Front of the Players
How can I make players spawn with a sword after dying? - Close-Up Shot of a Can of Anchovies beside Olives
How can I make players spawn with a sword after dying? - Brown Coffee Beans in White Ceramic Mug



How do you make something happen when a player dies in Minecraft?

Here's the command to add the scoreboard: /scoreboard objectives add deaths deathCount , then, in a separate command block, put: /scoreboard players set @a deaths 0 . To testfor player's death, put in another command block: /testfor @a[score_deaths_min=<number of deaths>] .

How do you make things not lost on death in Minecraft?

After loading into a world, open the console and input the command, \u201c/gamerule keepInventory true.\u201d As a result, inventory items will now never be lost upon death.

How do you make players spawn in Minecraft With one block?

Create a new world, enter /gamerule spawnRadius 0 , kill yourself a few times and see if you appear on the same block.



Roblox Studio How to Give Players Items when they Spawn, Give Gear, Weapons or Other Objects




More answers regarding how can I make players spawn with a sword after dying?

Answer 2

Use a scoreboard objective that tracks the time since the player last died.

/scoreboard players add deathTime time_since_death

Then run, in a repeating command block:

/give @a[scores={deathTime=1}] wooden_sword

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Anna Shvets, Anna Shvets, alleksana, alleksana