I am trying to make save and load, but I ran into one problem: SetAsync does not save, unless I set it manually. I have tried datastore plugins such as DataStoreX, but none have worked. Code:
local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("DAT")
game.Players.PlayerAdded:Connect(function(player)
local coins = Instance.new("IntValue")
coins.Name = "coins"
coins.Parent = player
local playerUserId = "Player_"..player.UserId
local success, err = pcall(function()
coins.Value = dataStore:GetAsync(playerUserId)
end)
if success then
print("Load success!")
else
warn(err)
end
print(player.coins.Value)
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, err = pcall(function()
print(player.coins.Value)
local playerUserId = "Player_"..player.UserId
dataStore:SetAsync(playerUserId, player.coins.Value)
end)
if success then
print("Save success!")
else
warn(err)
end
end)
game:BindToClose(function()
wait(5)
end)
NOTE #1: I TRIED SAVING IN BOTH BINDTOCLOSE AND PLAYERREMOVING, BUT IT STILL DIDN'T SAVE. NOTE #2: I'M RUNNING INSIDE ROBLOX STUDIO

5 comments
Put stuff in the BindToClose that saves data for everyone in the server, should work then.
^ yeah, you should save during PlayerRemoving and BindToClose
I tried that, except i get this error: DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = Player_1217140517
hello?
that's fine as long as u don't spam save every second.