When you're writing a novel set in the real world you sometimes have to stop and research something. What's the procedure at the police station when you get arrested? How does the control panel work in a power station? Any number of things you need to get right.
But what about a novel set in a science fiction world (or a fantasy world, but anything could happen once you introduce magic)? There is much you have to invent, on top of the characters and the plot. I have no background in science so I find it particularly difficult with machinery of any kind, to make it sound plausible. How does a ray gun work? Or a plasma rifle or laser pistol? What's the difference anyway?