Please help, this cooldown doesn't work in specifically multiplayer. It is pretty important for it to work in multiplayer consider that I'm making this datapack for my friends servern. While testing I found that sometimes the cooldown bossbar (not the scoreboard) just goes down extra quickly, and sometimes the bossbar just disapears completely despite the scoreboard still ticking down (or I think so at least). Now this is just the code for one abilitys cooldown, but the other ones are just copy+pasted and changed.
Running every seconds using schedule: execute at @a as @a run function marbles:zephyr_marble/wind_dash_cooldown
Wind Dash Cooldown function:
execute store result bossbar minecraft:wind_dash_cool value run scoreboard players get @s wind_dash_cool
scoreboard players remove @s wind_dash_cool 1
bossbar set minecraft:wind_dash_cool name {"text":"Cooldown - Wind Dash: ","extra":[{"score":{"name":"@s","objective":"wind_dash_cool"}}],"color":"white"}
execute if score @s wind_dash_cool matches ..0 run bossbar set minecraft:wind_dash_cool visible false
execute unless score @s wind_dash_cool matches ..0 run bossbar set minecraft:wind_dash_cool visible true
The cooldown part of the ability:
scoreboard players set @s wind_dash_cool 16
bossbar add minecraft:wind_dash_cool "Cooldown - Wind Dash"
bossbar set minecraft:wind_dash_cool color white
bossbar set minecraft:wind_dash_cool players @s
execute store result bossbar minecraft:wind_dash_cool max run scoreboard players get @s wind_dash_cool
execute store result bossbar minecraft:wind_dash_cool value run scoreboard players get @s wind_dash_cool
bossbar set minecraft:wind_dash_cool name {"text":"Cooldown - Wind Dash: ","extra":[{"score":{"name":"@s","objective":"wind_dash_cool"}}]}
bossbar set minecraft:wind_dash_cool visible true
Version: 1.21.11