Where do I store values in the Local Player?

The title is pretty self-explanatory, but I can’t seem to figure it out. After a little research, I learned that you cannot put values inside of the player’s Backpack, which is what I had been trying to do up until that point. Instead, I tried to make a new folder with all the values that replicates to the player when they join. However, when I try to edit those values via script, nothing happens. Where is the proper place to put values inside of the local player?

1 Like

Create a folder inside the player and there you can store number values.

Are you sure your doing this correctly? It would be easier to help you if we could see the script.

1 Like

Sorry, wasn’t thinking when I made this topic. Here’s an example of the code, located inside of a script in ServerScriptService. ‘Values’ is the folder I created, and TESTVALUES is, well, the test value.

game.Players.LocalPlayer.Values.TESTVALUES.Value = 1
1 Like

Well of course it doesn’t work, your trying to access the LocalPlayer from the server side.

You should be doing this when trying to access the folder from the server side:

     player.Values.TESTVALUES.Value = 1

I put that script into the ServerScriptService, and it didn’t work. Am I supposed to put it somewhere else? As you can tell, I suck at scripting lol.

Did the number value inside the values folder change to 1? Can you show what’s in the output?

Have you tried checking the output when running the script? I am pretty sure the script @zektonn posted should work.

Maybe you need to wait upon the player joining, as the values folder hasn’t loaded in yet?

Do you have a script that adds the value folder into the player when they join??

…That’s what “and it didn’t work” means.

I got the error: " Values is not a valid member of Player “Players.2xA_Imagineer95” - Server - Script:2"

Fire a remote to the client to change the value in the Player

Considering you’re creating the Folder on the Client, the Server won’t be able to see that either way no matter if you wait for the Player to join and use that Player argument to access it’s instances, you must fire a remote to the client to access that Client folder you made.

That means you named your folder incorrectly, or it hasn’t loaded in fast enough.

That means either the values folder has not been inserted into the player or you need to wait a few seconds for it to load in.

If you want to create a folder inside a player on joining:

    local Folder = Instance.new(“Folder”, player)
    Folder.Name = “Values”

    local Value = Instance.new(“IntValue”, player)
    Value.Name = “TESTVALUES”