I don't have any good suggestions, but I can say that I have multiple Roku remotes and multiple Samsung TVs that can be controlled by them. Make sure you're pointing the remote at the front of the TV during the process and you may want to stand close to the TV. I had an issue with a Roku remote and an Insignia TV where the remote would turn the TV on from anywhere, but to turn it off you had to be close to the TV or try several times. It took a while to find the proper code because it appeared to be the wrong one since the TV wouldn't turn off, but it had been the right one all along.
Have you also tried both the "IR setup" and "CEC setup" assuming those options appear under "Set up remote for TV control"? For CEC, you don't have to point the remote at the TV, but you may have to enable "Anynet+" in the TV's settings if it's not enabled by default.