#Equivalent to Utils.server ?
9 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
The XY problem is when you really want to do X, and you think that Y can achieve X. However, you can't get Y to work, and so ask for help exclusively about Y.
This can lead to a lot of confusion from the people trying to help you, as Y can seem like a very random thing to want to do, and a lot of the time isn't the best way to achieve X anyway.
Its fine to ask about Y, just always include some context about X so you can be put on the right track if Y won't do X well, or there is an easier way to do X.
What do you need this for?
No specific use case actually. I sometimes use player pData and server pData in tooltips or to synchronize some specific event.cancel() with server in 1.20 . I know pData thing is broken for now and there's workaround with NetworkEvents or JsonIO, so it's not a big deal if there's no such thing anyway. I just want to check if the old methods I used in 1.20 would work in 1.21
theres no referencing the server in client scripts because the server doesnt read client scripts, if you're referring to grabbing server side pData then just use pData with NetworkEvents, people say it doesnt work for whatever reason but it does work as far as my [current testing](#1326236210011574332 message). Some things may be different with pData like how tags are stored/read so that's probably what people are getting caught up on when they transfer their 1.20.1 scripts to 1.21 and find out some of their values [are undefined](#1336274794752114689 message). if you have a script you're testing then send it here and it'll be easier to figure it out. otherwise you can try this [remake of pdata](#1326236210011574332 message) in 1.21 which should essentially replicate it though like i said before the kjs built in pdata works just fine as far as i've tested
Thank you for the information. I'd do some actual test later
ok so after further discussion about it in another channel the issue people were having with persistent data in 1.21 is changing the values via the built in kjs ways like persistentData.SomeValue++ or persistentData.SomeValue + 1 ect
the issue with this is that the persistent data object is an object type instead of a number and isnt getting parsed back to a number before modifying it with a number and an operand so a workaround to this would be to instead directly use the compound tag methods of js event.player.persistentData.putInt("SomeValue", event.player.persistentData.getInt("SomeValue") + 1)
After some testing myself, I can confirm that the pData is working. Thanks for the help.