It was typed differently
Capital letters matter in many games, and a space at the start or end is enough to fail. Copy and paste instead of typing. Letter O and number 0, or letter l and number 1, are easy to swap.
It expired
Creators end codes without notice, often at the next update or after an event. If many people report that a code failed, it probably ended.
You already used it
Almost every code works once per account. Some games show the same message for used and expired codes.
Your server is old
After an update, servers that were already open may still run the previous version, which does not know the new code. Leave and join a new server.
The game has a requirement
A minimum level, a finished tutorial, liking the game or joining a group may be needed. Check the game's description on Roblox.
Still failing
Vote that it did not work on the game's page, so others know. Be careful with anyone who offers to redeem it for you: you never need to share your password.