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

DataStore Sometimes Not Saving?

Asked by
VAnkata20 135
3 years ago
Edited 3 years ago

The Datastore I made Was For a Game I am Working On But Sometimes Its Not Saving The Data. I Tried Everything But I Could Find A Way So Thats Why I Am Asking Here. There Is Also A Properties Folder Containing XPPerLevel , AdditionalXPNeeded , LevelCap , XPExponentMagnitude , XPPerLevel.

001local Properties = game.ReplicatedStorage.LevelUpProperties
002 
003function onXPChanged(player, XP, level)
004    if string.lower(Properties.XPType.Value) == "linear" then
005        if XP.Value>= Properties.XPPerLevel.Value * (level.Value) + Properties.AdditionalXPNeeded.Value and level.Value < Properties.LevelCap.Value then
006            XP.Value = XP.Value - (Properties.XPPerLevel.Value*(level.Value) + Properties.AdditionalXPNeeded.Value)
007            level.Value = level.Value + 1
008        end        
009    end
010end
011 
012function SaveData(Player)
013    if Player.DataReady == false then
014        print("Could not save, DataReady is false.")
015        return
View all 118 lines...
0
I hate data store stuff -.- I'm sorry but I'm not going to read it all ... I will just say, look up "BindToClose()" it might help ???????? AlexTheCreator 461 — 3y
0
I Tried "BindToClose()" And I Have The Same Problem VAnkata20 135 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

you're trying to use the old (deprecated) way to load data while saving with DataStoreService, use DataStoreService for saving and loading

also use ipairs/pairs (pairs if you're looping through a dictionary) to loop through tables

0
ok but can you show me the new way to do it because i dont know how VAnkata20 135 — 3y
0
you should learn yourself with the official wiki (https://developer.roblox.com/articles/Data-store), modify the LoadData function to work with DataStoreService TheBoys810 30 — 3y
0
Thanks VAnkata20 135 — 3y
0
no problem TheBoys810 30 — 3y
Ad

Answer this question