In Shakespeare's Hamlet, Rosencrantz and Guildenstern are Hamlet's friends from university. They come to the castle ostensibly to visit Hamlet but really to spy for Claudius and Gertrude.
These characters, along with almost everyone else, fail to heed Polonius' words, which contribute to a theme central to the story:
to thine own self be true ....
Thou canst not then be false to any man. (I.iii.78, 80)
In the context of the time, Polonius (who is full of wonderful advice but never able to follow it himself) is telling Laertes to make sure he has his priorities straight. He is not telling him to be selfish but, more accurately, is telling him that the way to take care of others whom you love is to protect and care for yourself first.
Today, we might take this to mean that being true or honest with yourself will mean it is impossible to lie to another. Shakespeare illuminates Polonius's advice showing it should be taken very seriously. In fact, those who do not follow this advice end up dead. From either temporal perspective--then or now--it is apparent there is the need to be honest with yourself and with others. Horatio may be the only one who understands this concept.
Gertrude allows herself to be wooed into a morally questionable marriage, an action that causes Hamlet a great deal of distress. (Elizabethans believed that to marry a person related by marriage was incestuous.) She is seen by some critics as being shallow but well-meaning. Had she thought of Hamlet first—or of her love for Old Hamlet—she might not have married again thus might have survived.
Laertes wants revenge for his father's accidental death and then for Ophelia's madness and death. Plotting to kill Hamlet serves Laertes' needs, and the King's, but it is divergent from Laertes' true values and harmful to Hamlet.
Polonius and Claudius are also both self-serving. Both are men who are interested solely in themselves. Claudius murders his brother to steal Denmark's crown. He forfeits his honor and, according to his religious beliefs, loses his immortal soul by committing regicide (the murder of a king). His actions also bring harm to Hamlet and Gertrude.
Some critics suggest that Polonius's advice to Laertes is not for his son's benefit, but seems only to be given for the sake of talk. The argument is that his advice is hallow since he does all he can to court favor with the King. Specifically, he spies in order to ingratiate himself with Claudius, illustrating no real concern for Hamlet.
Ophelia herself suffers at the hand of Polonius to advance his favor with the King. She allows herself to be used against Hamlet's and to his detriment. She becomes a spy for Polonius and the King, although it seems she had little choice.
Rosencrantz and Guildenstern equally, like Ophelia, profess concern, but are similarly manipulated to serve the King so as to advance their own fortune. Hamlet refuses, as a king's son, to answer to a "sponge." He explains that Rosencrantz is a "sponge," soaking up any news (and rewards) he can get.
Besides, to be demanded of a sponge, what replication should
be made by the son of a king? (IV.ii.13-14)
Hamlet warns both men the King will use them until they can no longer be of service:
He keeps them, like an ape, in the corner
of his jaw; first mouth'd, to be last swallowed. When he needs what you have glean'd, it is but squeezing you and, sponge, you shall be dry again. (18-21)
In the end, Hamlet tells them nothing having no trust in them. For betraying Hamlet, they are executed in his place because they were dishonest and self-serving: They see to their own interests without thought of anyone else, which is a perversion of the advice Polonius gave Laertes. Their characters are negatively judged by Hamlet because of their lack of integrity.