A really useful tutorial for beginners.
Often, studio shuts down too fast and PlayerRemoving can’t fire. Simply saving everyones data would work but it would throw a “DataStore request added to queue” warning and freeze a bit (which isn’t bad, but still), that’s why I often use something like this if I want it to save in studio:
game:BindToClose(function()
if RunService:IsStudio() then
wait(1)
else
for i,player in ipairs(Players:GetPlayers()) do
coroutine.wrap(save)(player)
end
end
end)
Basically make it wait 1 second if it is studio, to let PlayerRemoving fire.
If anyone knows any better way, feel free to reply.