God told Moses two different times to use the rock to supply water to the Israelites while they were in the desert. The first time, God told Moses to strike the rock (Exodus 17:6). The second time, God told Moses to speak to the rock. But Moses was angry with the Israelites because they were very disobedient. In his anger, Moses struck the rock (Number 20:11-12). This was a terrible thing to do.
The first time, when God told Moses to strike the Rock, it was to predict when Jesus would be nailed to the cross. The second time, when Moses was to speak to the Rock, it was to predict Jesus being raised from the dead and available to everyone who calls to Him.
The moral of this story is to always do what is right, even if your feelings tell you to do something else.