PlayerRemoving / BindToClose no longer respects SetAsync / UpdateAsync

A server script with a simple save on leave function no longer works when you’re testing in studio.

local DSS = game:GetService("DataStoreService")
local PLR = game:GetService("Players")
local save = DSS:GetDataStore("Save")

PLR.PlayerRemoving:Connect(function()
	print("saving")
	save:SetAsync(123, "test")
	print("it saved")
end)

output:
saving…

A private message is associated with this bug report

3 Likes

Hi, I tried this on a baseplate and it seems to work fine. Does this script work for you on a completely empty place?

1 Like

Yes, I’ve tried with a completely empty place & all my plugins turned off and the data store does not update.

Do you have it set to yield within BindToClose?
ie

game:BindToClose(function()
	task.wait(2)
end)

Because the server will “immediately” close in studio if it doesn’t have to wait for anything in the bindToClose function, so any Async functions won’t run unless we yield in BindToClose.

I cannot replicate your issue after yielding in BindToClose.

No, the example I gave is all that it is. Wonder why it would only be an issue on my end… I’ll try reinstalling & restarting my PC in a bit.

Hi,

I’m experiencing the same issue. Everything worked fine about 16 hours ago, but since then it’s been hit‑or‑miss—it errors when running/fails to run about half of the time.

I haven’t touched any settings, and rolling back to a version from three days ago didn’t fix it either…

This got fixed with the new update. /shrug