#Is there a way to make the changed value of a variable remain after you shutdown the world/log off

10 messages · Page 1 of 1 (latest)

dense river
#

Title. I have some features that allows you to level up and the values are stored in Kubejs variables. However, when the server shutdown or the player leaves their single player world the value reverts back to what it was before they leveled up. So is there a way to keep the value of the changed variables? Any help would be so so appreciated.

cerulean novaBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

valid otter
#

event.server.persistentData.someValue = 20

#

or if you want per player, event.player.persistentData.someValue = 22

dense river
valid otter
#

event.player.persistentData.someValue

#

console.log('someValue='+event.player.persistentData.someValue)

flat falcon
#

Is this feature present on 1.18 as well? I'll definitely need something like this in the future

valid otter
#

yes

flat falcon
#

nice, thank you