Datastore Help!

I recently realised my datastore script stopped working, I don’t think I changed anything. Any help is strongly appreciated!!!

	if savedarmies[player.UserId] then
		local tosave = savedarmies[player.UserId]
		local Key = tostring(player.UserId).."Army"
		local Succes, ErrorMSG = pcall(function()
			ArmiesData:SetAsync(Key, tosave)
		end)
		
	end
end
game.Players.PlayerRemoving:Connect(function(player)
	if #game.Players:GetPlayers() > 1 then
		SavePlayerLayout(player)
	end
end)

game:BindToClose(function()
	for _, player in game.Players:GetPlayers() do
		print(player)
		coroutine.wrap(SavePlayerLayout)(player)
	end
end)```
1 Like

I just realised that the code cut off at the top: The missing line just defines the SavePlayerLayout(player) function.

1 Like