Diagnosis
Your TV's audio output setting is probably still set to its internal speakers instead of optical out.
How to Fix It
You need to change two settings. First, on your TV remote, go into the audio or sound settings menu. Look for "Audio Output" or "Speaker Selection." Change it from "TV Speakers" to "Optical" or "Digital Audio Out." Second, grab your soundbar remote. Press the 'Source' button until the white LED on the front shows 'OPT' for optical. That should get you sound.
If That Didn't Work
The optical cable might be bad or not fully seated. Unplug it from both ends and plug it back in firmly—you should hear/feel a click. Try a different optical cable if you have one. Also, check that the plastic protective cap was removed from the cable ends.
Heads Up
Some TVs require you to change the audio format in a separate menu. If sound is still missing or is choppy, look for a setting called "Digital Audio Format" and switch it from "Auto" or "Bitstream" to "PCM." That usually solves compatibility hiccups.