Most effective way to store variables/values for a player

I want to be able to store variables within a player, not to be confused with DataStores.

I made a module script that stores the variables/values and placed it in “StarterPlayerScripts” but the problem with that is that the module script can only be accessed on local scripts. I could just change the scripts into local scripts but I was wondering if there is a better way to do this.

1 Like

you can call the module script on the local script and then fire a remote event? but if you don’t want to you should rewrite the module to work on the server.

1 Like

I want each player to have there own separate variables/values, but also be accessible from server or client scripts. Though like I said before I don’t mind changing it to just client scripts.

Definitely don’t do that. Exploiters will be able to change it super easily. You could have a script in the Server with a table containing all the values, and the Client can invoke a RemoteFunction whenever they need the data.

There are three ways that you could do this.

  1. InstanceValues
  • Each player object has a folder that contains values. There are multiple types of InstanceValues, so it should cover up most value types that you will store.
  1. Attributes
  • You can add attributes to the Player object. It is the same as InstanceValues, but it is considered a “property” inside the Player object rather than a Folder inside the Player object.
  1. Variables
  • You can store player values in a script inside a table.