You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want know why ordered datastore is not saving my value
-
What is the issue? Include screenshots / videos if possible! Ordered DataStore Says it saves my Value but when i rejoin the game it is not saved
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I tried to do a bit of debugging to find the issue but to no sucess
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local DataStoreService = game:GetService("DataStoreService")
local CashDataStore = DataStoreService:GetOrderedDataStore("CashDataStore")
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Cash = Instance.new("IntValue")
Cash.Name = "Cash"
Cash.Value = 0
Cash.Parent = leaderstats
local SavedCash
local Sucess,ErrorMessage = pcall(function()
SavedCash = CashDataStore:GetSortedAsync(true, 5)
end)
if Sucess then
print("Sucessfully retrieved data")
else
warn(ErrorMessage)
end
end)
local SavedCash
game.Players.PlayerRemoving:Connect(function(Player)
local Sucesss,ErrorMessage = pcall(function()
SavedCash = Player.leaderstats.Cash.Value
end)
if Sucesss then
SavedCash = Player.leaderstats.Cash.Value
print("Sucessfully Saved Cash Order!")
else
warn(ErrorMessage)
end
end)
Hello, so i’m using ordered data stores to save my data but the problem is that my ordered data store says it sucessfully saved the data when i left the game but when i rejoin it does not save my value how come this is happening?