This is a DataStore
question, I hate these questions too. I don't quite know hot to throw all the details out there. Anyways, here's the script,
--Regular script in ServerScriptService local DataStore = game:GetService("DataStoreService"):GetDataStore("wfvj014") game:GetService("Players").PlayerAdded:connect(function(plr) local key = plr.UserId local Save = DataStore:GetAsync(key) if Save then plr.Skill.Value = Save[1] else DataStore:GetAsync(key,{plr.Skill.Value}) end end) game:GetService("Players").PlayerRemoving:connect(function(plr) local key = plr.UserId local ValuesToSave = {plr.Skill.Value} DataStore:GetAsync(key, ValuesToSave) end)
There are no errors. I've tested this again and again on servers after publishing the game.* I'm using a table* to save just in case I want to add more values later. The simple fact that I'm using tables might be the problem, I'm unsure.
I made sure the value, plr.Skill.Value, changes before leaving, and when trying to load the data, it seems to reset back to 1. The Skill is not in leaderstats
. It's an invisible tracker of the player's skill level.
If you know my problem, please tell me.
Thank you.
Well the issue is rather simple to find. On line 17 you are attempting to load data rather than saving. this mean there is nothing to load since you never saved. This would be a rather simple fix. All you have to do is use SetAsync() rather than GetAsync()