How to make a mana bar system. Minecraft(JAVA)
Today I will show you how to make a magic/mana bar system. you can summon spells that take mana and makes the spells. You also regain mana over time.
Commands:
1st commands/set scoreboard: /scoreboard objectives add mana dummy
2 command/add score:/scoreboard players add @p mana 0
3 command/custome egg:
/give @p minecraft:zombie_spawn_egg{display:{Name:'{"text":"magic_boom"}'},EntityTag:{CustomName:'{"text":"wow"}'}} 1
4 command start/ first mana: /title @p[scores={mana=0}] actionbar [{"text":"", "color":"blue"}, {"text":"[][][][][][][][][][][][][][][][][][][][][]", "color":"red"}]
5 command/ end mana bar: /title @p[scores={mana=21}] actionbar [{"text":"[][][][][][][][][][][][][][][][][][][][][]", "color":"blue"}, {"text":"", "color":"red"}]
6 command/regain mana: /scoreboard players add @a mana 1
7 command/not to low mana:/execute at @a[scores={mana=-1}] run scoreboard players set @a mana 0
8 command/ not to high mana: /execute at @a[scores={mana=22}] run scoreboard players set @a mana 21
1 magic spell command: /execute as @a if score @s mana matches 5..21
2 magic spell command: /kill @e[type=minecraft:zombie,name=wow]
3 magic spell command: /execute at @a if entity @e[type=item,distance=0..5] run scoreboard players remove @p mana 5
Note: make sure to to do all mana bar blocks i included the first and last one on here do all of them imbetween other wise you wont be able to see it.
make sure to do it excatly the same ot watch the video for help.