Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

SAFEST EFFICIENT place to store player data?

What would be the most safest place to store player data? I know storing it in the player isn't safe because it can be modified client sided what would be a better alternative that's also efficient?

4 comments

1

Try using DataStoreService

0

Yup, use DataStore

0

DataStore and FilteringEnabled

1

You would only use a data store if you want the data to persist when games are not running. You should be using FilteringEnabled regardless of what you are doing, with FE it is safe to store the player data in the players object.

1 answer

✓ Accepted answer

The best way to safely save player data (In my experience) is using DataStoreService. You would get DataStoreService using:

local dss = game:GetService("DataStoreService")

Now that we have the DataStoreService, we still need to make a DataStore, by doing this we will acces or if there is no create one

local dss = game:GetService("DataStoreService") -- Getting the DataStoreService

local store = dss:GetDataStore("DataStoreNameHere")

We now got our data store

It doesn't matter what you call the data store!

Now that we have accesed or created the data store, we still need to save something!

local dss = game:GetService("DataStoreService") -- Getting the DataStoreService
local store = dss:GetDataStore("DataStoreNameHere") -- Getting the data store

store:SetAsync("Key", "DataHere!") -- I highly suggest using the PlayerId as the key!

Now that we can save data, we still need to load it right?

local dss = game:GetService("DataStoreService") -- Getting the DataStoreService
local store = dss:GetDataStore("DataStoreNameHere") -- Getting the data store

local player_data = store:GetAsync("Key") or 0

Notice that i used or 0 this is if you haven't saved anything in the data store using that key, it will be nil! So if you haven't saved anything using the key, it will get 0 instead of returing nil!

The 0 can be anything! If you load it in a Value, make sure to use the right one!

For more in-depth information!

I really hope i helped you! If so, please accept this answer as i tried my best to explain this to you!

So if i misspelled some words, or if i used bad grammar somewhere in this answer. But i can explain why, it's easy, i'm not English so i make grammer errors/misspel some words

~jordikeijzers

3 comments

0

This is probally my best explained answer... Lol

0

Good answer, +1, keep it up

0

Thanks! I tried my best explaining this :D

This discussion is preserved as it was. New answers, comments, and votes are closed.