Sometimes roblox studio can’t save the data correctly, but you could try this.
local RunService = game:GetService("RunService")
game:BindToClose(function()
if (RunService:IsStudio())then
wait(3)
else
for i, v in next, game:GetPlayers() do
if v then
coroutine.wrap(Set)(v) -- creates a new thread, to avoid that the repeat until affects the loop and all the players manage to save their data without having to wait.
end
end
end
end)
This is only to improve saving when shutting down the game or exiting roblox studio test mode.