A code redeem panel lets players type a promo or creator code and receive a reward. The interface is simple — a TextBox plus a redeem button — but the security is one-directional: the client only sends the code, and the server decides whether it is valid and grants the reward. This guide builds both sides in Luau.
1. TextBox input and a redeem button
A TextBox collects the code, a TextButton fires the request. On click, read the box's text and send it to the server through a RemoteEvent.
2. Validate codes on the server
Keep the list of valid codes and their rewards in a server Script. Normalize the incoming code (uppercase, no spaces), look it up, and ignore anything unknown. The client never sees the list.
Tip: Never trust the client. Only the server knows which codes are valid and must be the one to grant coins or items.
