Update simple schema (Solved)

Hi! I'm having issue updating a single schema. The only example I found was about MapSchema or ArraySchema. I'm trying to replicate the logic for a single schema created in the StateHandler and It does not seems to work. I'm not having any issue with the MapSchema Update and ArraySchema update... only with the single Schema. What am I doing wrong?

0_1664905157236_Screenshot 2022-10-04 103724.png

0_1664905165872_Screenshot 2022-10-04 103757.png

0_1664905172956_Screenshot 2022-10-04 103844.png

hey @Rangerz132, welcome!

onAdd is only called for "collections" of items, you could attach the onChange callback directly on it:

this.room.state.mole.onChange = (changes) => {};

Alternatively, I'd suggest using .listen() instead:

this.room.state.mole.listen("x", (value) => {})
this.room.state.mole.listen("y", (value) => {})

That's perfect! Thanks for the quick response!