Ok there are no errors or anything in the output which means I guess the BindToClose isn't running
Basically I'm trying to save a IntValue named money and its inside the player Datastore is a Datastore called Datastore
Im trying to save everyones datastore incase of shut down
I tested this in game in a 1 player server because my game isn't popular
game:BindToClose(function()
for i,v in pairs(game.Players:GetPlayers()) do
succ,fail = pcall(function()
Cor = coroutine.wrap(function()
DataStore:SetAsync(DataStore,v.UserId,v.Money)
end)
Cor()
end)
if succ then
print('Success')
else print(fail)
end
end
end)

1 comment
SetAsync is used incorrectly. It should only have two parameters, the key and the value. https://developer.roblox.com/api-reference/function/GlobalDataStore/SetAsync