You lose resources, depending on how much the attacker “destroys”. If the attacker destroys everything, you can lose up to a maximum of 50% of Elixir/Gold in your collectors, 100% of Elixir/Gold in your Town Hall, and 10-20% of Elixir/Gold in your storage containers depending on your Town Hall level.