Forum Discussion

Tiitouaan's avatar
Tiitouaan
Member
22 days ago

Player Persistent Variables still initializing...

Hello everyone,

I'm encountering a frustrating issue while using Persistent Player Variables (PPVs). I have created three Number PPVs (let's call them A, B, and C), but only one of them is successfully loading its value.

I am accessing these variables using the standard synchronous method (this.world.persistentStorage.getPlayerVariable(...)).

The following line of code, called in my Script 1, consistently generates the warning, and returns the default value (0):

const recoilMultiplier = 1 + this.props.multiplierSnap * this.world.persistentStorage.getPlayerVariable(this.player, PersistentVariables_Data.playerPersistentVariables.number.recoilMultiplier);

Warning Message:

Player persistent variables still initializing... Returning empty state

In my Script 2 (which runs successfully later in the game cycle), I access the other two variables:

const knockbackMultiplier = 1 + this.props.multiplierSnap * this.world.persistentStorage.getPlayerVariable(shooter, PersistentVariables_Data.playerPersistentVariables.number.knockbackMultiplier); const resistanceMultiplier = 1 - this.props.multiplierSnap * this.world.persistentStorage.getPlayerVariable(player, PersistentVariables_Data.playerPersistentVariables.number.resistanceMultiplier);
  • Variable A (knockbackMultiplier) is loading correctly. No warning.
  • Variable B (resistanceMultiplier) is generating the same warning message.

I created all three PPVs (A, B, and C) the exact same way at the same time in the World Editor. They are all defined as Number PPVs. I don't understand why two of them are throwing the still initializing warning while the third one works perfectly, despite all being called using the same mechanism.

Has anyone experienced this specific issue where two out of three PPVs are stuck in the "initializing" state? Could this be related to a null initial value or a server-side cache lock specific to my user profile for these variables?

Any insight would be greatly appreciated! Thank you.

3 Replies

  • Getting persistent variables require a reference to the player and a string. Looks like you're giving it a player and a number? 

    Besides that a couple of other reasons for this are trying to request ppvs from a local script or on an NPC.