I think it’s because you’re only setting the variable once. Once you set a variable and assign something to it, it won’t change whatevers assigned to it, it’ll stay with it’s original data, even if you change the value, etc. For example:
local Value1 = script.Parent.Value -- Imagine this value is "1"
script.Parent.Value = 2 -- Here we will change the value.
print(Value1) -- You would assume this will print "2" but it'll print "1" because once you assign a variable, it's stays in it's original state until you re-assign it. (the Value1 variable.)
Oh, I see what you mean.
Probably because of how .PlayerAdded scripts for local scripts, it’ll only work for when other players joins the game, because the script only loads after your player gets added.
What do you mean?
Shouldn’t that return the value asociated with the key?
After all, this does work, the cache prints successfully on the server but not on the client.
pretty sure when you placed code to be returned it actually runs, and that the only way to return a function is to set it as a variable and return the variable.
If you’re using a local script for .PlayerAdded, the localplayer cannot run the event themselves because the script only loads after the player is added which means the event will only run when another player joins, since your side of the script has loaded after you joined, it won’t run for you because your local script loads after your player. That’s why it only works for serverscript, because it’s already loaded from the server.
remove the return thingy so the pcall will catch the actual error
also delete your data, otherwise it’ll keep doing the error
cuz it is saved already
This seems to be a client/server boundary issue if it is printing properly on the server but not on the client. I just now tested it and I was correct, the client cannot access changes to module scripts from the server.
Instead try using int values for the playerId and a vector3Value as the playerId’s child OR you can use a remote function/ event to retrieve the position(remote function more practical for this situation if called from the client)