The following bit of code is fired at Players.PlayerRemoving()
, right before game:BindToClose()
(Studio) from a ModuleScript (it’s for a module).
local s, r = pcall(function()
DSS:GetDataStore(key):SetAsync("data", currData) -- currData is not nil, already checked
end)
print("Save Output Begin")
print(s)
print(r)
print("Save Output End")
Here’s the issue: When I save at PlayerRemoving
, nothing saves and I get no output. However, when this same bit of code is executed mid-game, it saves and I get all 4 bits of output. I’m assuming this is because the server is shutting down and yada yada.
My question is: How can I make it such that it saves at :PlayerRemoving()
?