So I have been trying to get this ordered datastore to save 3 different player datas. I have tried saving them separately, but I get the orange error that says theres too many inputs for the key. It said it didn't allow Dictionaries either. Then a JSON encoded it but it doesn't accept strings. I need help. I Know that Ordered datastores only accept numbers. Heres the code:
local DSS = game:GetService("DataStoreService") local DS = DSS:GetOrderedDataStore('plrData') game.Players.PlayerAdded:Connect(function(plr) local data local key = plr.Name pcall(function() data = DS:GetAsync(key) end) local folder = Instance.new("Folder") folder.Parent = plr folder.Name = 'leaderstats' local Steps = Instance.new("IntValue") Steps.Parent = folder Steps.Name = 'Steps' local Total = Instance.new("IntValue") Total.Parent = folder Total.Name = 'TotalSteps' local Wins = Instance.new("IntValue") Wins.Parent = folder Wins.Name = 'RaceWins' if data then Steps.Value = data.idk['Steps'] Total.Value = data.idk['Total'] Wins.Value = data.idk['Wins'] else Steps.Value = 0 Total.Value = 0 Wins.Value = 0 end end) game.Players.PlayerRemoving:Connect(function(plr) local key = plr.Name local idk = {} idk['Steps'] = plr.leaderstats.Steps.Value idk['Total'] = plr.leaderstats.TotalSteps.Value idk['Wins'] = plr.leaderstats.RaceWins.Value DS:SetAsync(key, idk) end)
reminder: no rude or toxic stuff about the simulator part.
Sorry, but OrderedDataStores are used for saving an integer to a key. They cannot be used with other values.. etc.
If you want to sort singular stats like wins or points, save the individual values to different OrderedDataStores.