The "secret" to making perfect cuts is starting with straight edges in the first place...HUH? A table saw, even if it's set up "perfectly" will create a curved cut if the piece is curved and registered against the fence. You must sight each board to see if there is any curve on the edge before trying to rip them.
OK, there is a curve, now what? If you have a jointer you straighten the edge, then rip it on the table saw. If you don't, then you can hand plane the ends to get a straight edge. Construction lumber, like 2 x 4's are rarely perfectly straight. This is why cabinet shops and other well equipped wood shop will always have a long bed jointer.
Without a photo of what you are trying to do, a generalized answer is about the best I can do. Plywood will generally have a near perfect edge as it comes from the factory. So when possible, use that edge against the fence and your rips should come out very close.
If your saw is NOT set up correctly, that's a whole 'nother ball game. Check You Tube for how to set it up.
Blade should be parallel to the miter slots, fence should be parallel to the miter slots. The miter slot is the set up standard of the table saw, since it is NOT adjustable.
The answer to your question will only be as detailed and specific as the question is detailed and specfic. Good questions also include a sketch or a photo