I am making a game, where players get a random item every 10 seconds. So far, the code works but the bossbar progress doesn't go down, and there isn't any errors. please help and thank you!
Code:
every 10 second:
loop all players:
if {BedrockTowers::%loop-player%.random} = true:
set bossbar progress of {_timerBar} to 90
wait 1 second
set bossbar progress of {_timerBar} to 80
wait 1 second
set bossbar progress of {_timerBar} to 70
wait 1 second
set bossbar progress of {_timerBar} to 60
wait 1 second
set bossbar progress of {_timerBar} to 50
wait 1 second
set bossbar progress of {_timerBar} to 40
wait 1 second
set bossbar progress of {_timerBar} to 30
wait 1 second
set bossbar progress of {_timerBar} to 20
wait 1 second
set bossbar progress of {_timerBar} to 10
wait 1 second
set bossbar progress of {_timerBar} to 0
wait 1 second
set bossbar progress of {_timerBar} to 100
if {BedrockTowers::%loop-player%.random} = true:
give loop-player a random element of all items
wait 1 second
command /togglerandomitems:
trigger:
if {BedrockTowers::%player%.random} = true:
set {BedrockTowers::%player%.random} to false
delete bossbar named "timer"
message "&7You have disabled random items" to player
else:
set {BedrockTowers::%player%.random} to true
set {_timerBar} to bossbar named "timer" with title "Random Item Timer" with color red with style segmented 10 with progress 100
add all players to {_timerBar}
message "&7You have enabled random items" to player