Obviously, the police will use force if you do not cooperate.

Is this grammatically correct? I need to write a sentence to show how a comma should be used after introductory words or groups of words.

Yes. That is correct.

Thank you very much.

You're very welcome.

Yes, your sentence is grammatically correct. It correctly demonstrates the use of a comma after introductory words or groups of words. The introductory phrase in your sentence is "obviously," which is followed by a comma before the main clause "the police will use force if you do not cooperate." This comma helps to separate and indicate the pause between the introductory phrase and the main clause.