Hi, I've set up a simple counter that increases a variable's value by 1 every second. However, it seems that the variable is set to null every start of the while loop. What's weird, though, is that the counter does seem to save while in the while loop, but anything outside the while loop or at the very very start of the while loop will simply display null. Am I doing something wrong? Thanks a lot in advance!
Code:
on join:
while player is online:
#Where I suspect the variable gets reset to null
add 1 to {_counter::%player%}
send "Counter: &7%{_counter::%player%}%" to player #Outputs the correct values (1, 2, 3, etc.)
wait 1 second
#Variable still has value
command /counter:
trigger:
send "Counter: &7%{_counter::%player%}%" to player #Returns null