Timer with skBee help

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

GfungIsGreat

Member
Apr 14, 2024
1
0
1
24
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
 
{_timerBar} is a local variable, which means it is deleted after the command is run. You will have to set it to a global or RAM variable.

Or, you can simply change the progress of bossbar named "timer".