for i,M in pairs(game.Players:GetPlayers())do if storage.GetData(M.UserId)==nil then storage.LoadData(M.UserId)end end game.Players.PlayerAdded:connect(function(i)storage.LoadData(i.UserId)end)game.Players.PlayerRemoving:connect(function(i)storage.SaveData(i.UserId)end)
-- A redundant check for those who loaded before the server runs this script
for i, v in pairs(game.Players:GetPlayers()) do
	if storage.GetData(v.UserId) == nil then
		storage.LoadData(v.UserId)
	end
end

game.Players.PlayerAdded:connect(function(player)
	storage.LoadData(player.UserId)
end)

game.Players.PlayerRemoving:connect(function(player)
	storage.SaveData(player.UserId)
end)
