Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

SAFEST EFFICIENT place to store player data?

Asked by 8 years ago

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?

1
Try using DataStoreService Valatos 166 — 8y
0
Yup, use DataStore Perci1 4988 — 8y
0
DataStore and FilteringEnabled NinjoOnline 1146 — 8y
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. User#5423 17 — 8y

1 answer

Log in to vote
3
Answered by
Valatos 166
8 years ago
Edited 8 years ago

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

0
This is probally my best explained answer... Lol Valatos 166 — 8y
0
Good answer, +1, keep it up NinjoOnline 1146 — 8y
0
Thanks! I tried my best explaining this :D Valatos 166 — 8y
Ad

Answer this question