• Trending
  • Get Robux
  • How to create Game Pass?
  • Making Skins
  • Roblox Developers SALARY
  • CONTACT US
SUPPORT
Create your Roblox games to earn Robux with Roblox Studio :)
  • Home
  • Roblox Studio Tutorials
    Beginner TutorialsRoblox Studio Tips

    21 Super Useful Hotkeys in Roblox Studio you must know

    BloxCreators
    BloxCreators
    May 14, 2022
    how to publish Roblox Shirt
    Beginner TutorialsEarn RobuxMake Roblox Items

    How to make Roblox shirt? Step-by-Step guide

    BloxCreators
    June 6, 2025
    Beginner TutorialsRoblox Studio Tips

    21 Super Useful Hotkeys in Roblox Studio you must know

    BloxCreators
    May 14, 2022
  • LUA Scripting
    Beginner TutorialsMake Roblox Items

    Adding images in Roblox Studio: Roblox Decals

    What you need is copy the Decals ID and paste to the…

    BloxCreators
    BloxCreators
    May 14, 2022
    Beginner TutorialsLua Scripting
    How to make a simple Leaderboard with Roblox’s studio?
    Beginner TutorialsLua Scripting
    How to Create an Interactive NPC Experience with Proximity Prompts?
    Beginner TutorialsEarn RobuxMake Roblox Items
    How do I make a skin by myself in Roblox just 10 minutes?
    Beginner TutorialsRoblox Studio Tips
    10 Ways you should know for protecting your Roblox account
  • Get Robux
    Beginner TutorialsRoblox Studio Tips

    21 Super Useful Hotkeys in Roblox Studio you must know

    BloxCreators
    BloxCreators
    May 14, 2022
    Beginner TutorialsLua Scripting

    How to make a Roblox Game Pass in 10 minutes?

    how to publish Roblox Shirt
    Beginner TutorialsEarn RobuxMake Roblox Items

    How to make Roblox shirt? Step-by-Step guide

    BloxCreators
    June 6, 2025
  • Support Us
  • Bookmarks
Reading: How I create the simple code redeem system in Roblox Studio?
Share
Create your Roblox games to earn Robux with Roblox Studio :)Create your Roblox games to earn Robux with Roblox Studio :)
Font ResizerAa
  • Adventure
Search
  • Home
    • Home 1
    • Home 2
    • Home 3
    • Home 4
    • Home 5
  • Categories
  • Bookmarks
    • My Bookmarks
    • Customize Interests
  • More Foxiz
    • Blog Index
    • Sitemap
Have an existing account? Sign In
Follow US
© Foxiz News Network. Ruby Design Company. All Rights Reserved.
Create your Roblox games to earn Robux with Roblox Studio :) > Blog > Beginner Tutorials > How I create the simple code redeem system in Roblox Studio?
Beginner TutorialsEarn RobuxLua Scripting

How I create the simple code redeem system in Roblox Studio?

The Game Code is literally just a set of pre-defined codes by the Roblox game developers, provided for the selected players enter the secret codes to unlock some features, or redeem some coins, tools and so much more

BloxCreators
Last updated: June 20, 2025 9:53 pm
BloxCreators
Share
6 Min Read
code-redeem-system
SHARE

I guess you have use some “Cheat Code” playing Roblox games somehow Hmmmm?

Contents
User Interface setupRename and StylingScripting the logic on the server sideHandle Code Submit LogicTrigger when the code submitRemember to have leaderstats ready

What I mean is called “Game Code” in Roblox.

The Game Code is literally just a set of pre-defined codes by the Roblox game developers, provided for the selected players enter the secret codes to unlock some features, or redeem some coins, tools and so much more. This tutorial will show you how to create your own Game Code system in Roblox Studio. It’s quite simple to make it actually. Let’s get started!

User Interface setup

First, let’s set up the user interface. If you are not familiar with how to setup an User Interface, you can check it out the other tutorials I wrote serve for this purpose. Here you go.

Once you know what’s GUI is, let’s go to the StarterGui. First insert a ScreenGui. After that, just add a TextBox and a TextButton. As you can guess, the TextBox is used to input the game code, and the TextButton is used to trigger the script to redeem the input game code.

Rename and Styling

You may rename the TextBox to “CodeInputBox” and the button be “SubmitCodeButton” in the Explorer for easier navigation. Also, you can style the TextBox and Button with some background colour, modify the fonts size or any other styling you can think of.

Simple User Interface for Redeem Code
Rename the button and the textbox

Scripting the logic on the server side

In order to make it really work, we need to make some programming logics. In the ServerScriptService, insert a Script and name it CodeHandler, or any other name you think of.
With the below script, we’ll store handle the valid codes and decide what happens when a player enters one of them, in this example, I used one called “FREECOINS” and another one “SECRETITEM”

local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- RemoteEvent for communication
local CodeEvent = Instance.new("RemoteEvent")
CodeEvent.Name = "SubmitCode"
CodeEvent.Parent = ReplicatedStorage

-- Valid codes table
local validCodes = {
    ["FREECOINS"] = function(player)
        local leaderstats = player:FindFirstChild("leaderstats")
        if leaderstats then
            leaderstats.Coins.Value += 100
        end
    end,

    ["SECRETITEM"] = function(player)
        local backpack = player:FindFirstChild("Backpack")
        local tool = game.ServerStorage:FindFirstChild("CoolTool")
        if backpack and tool then
            tool:Clone().Parent = backpack
        end
    end
}


Handle Code Submit Logic

From the script, you can tell we add a code like “FREECOINS” that gives 100 coins, “SECRETITEM” that gives a free tool. At the end, we still need to handle what will happen when the code is submitted:

-- When a code is submitted
CodeEvent.OnServerEvent:Connect(function(player, code)
    code = string.upper(code)
    if validCodes[code] then
        validCodes[code](player)
        CodeEvent:FireClient(player, "Code redeemed!")
    else
        CodeEvent:FireClient(player, "Invalid code!")
    end
end)

Trigger when the code submit

Now, let’s connect the button to the server.
Inside the SubmitCodeButton, add a LocalScript and use below code

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CodeEvent = ReplicatedStorage:WaitForChild("SubmitCode")

local button = script.Parent
local textbox = script.Parent.Parent:WaitForChild("CodeInputBox")

button.MouseButton1Click:Connect(function()
    local codeText = textbox.Text
    CodeEvent:FireServer(codeText)
end)

CodeEvent.OnClientEvent:Connect(function(message)
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
        Text = message;
        Color = Color3.fromRGB(0, 255, 0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size24;
    })
end)

Remember to have leaderstats ready

This script will send the code text to the server, and also show a message in the chat if the code works. Oh by the way, if you’re giving out coins, make sure your game has leaderstats.
This little script gives every player a Coins value when they join. I have make a tutorial for how to create a leaderstats script, check it out!

How to publish a game on Roblox?
21 Super Useful Hotkeys in Roblox Studio you must know
Understanding If-Then-Else in Roblox Lua Scripting
How to Create an Interactive NPC Experience with Proximity Prompts?
How do I make a skin by myself in Roblox just 10 minutes?
TAGGED:Cheat CodeCode redeemleaderstatsRoblox CodeRoblox studioRoblox Tutorial
Share This Article
Facebook Email Print
Leave a Comment Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

12 − four =

New Releases

- Advertisement -
Ad image

Trending Stories

Beginner Tutorials

Understanding If-Then-Else in Roblox Lua Scripting

May 13, 2022
Beginner TutorialsLua Scripting

How to make a simple Leaderboard with Roblox’s studio?

June 17, 2025
Beginner TutorialsEarn RobuxLua Scripting

How I create the simple code redeem system in Roblox Studio?

June 10, 2025
Beginner TutorialsRoblox Studio Tips

21 Super Useful Hotkeys in Roblox Studio you must know

May 14, 2022
Beginner TutorialsRoblox Studio Tips

10 Ways you should know for protecting your Roblox account

June 16, 2025
Beginner TutorialsMake Roblox Items

Adding images in Roblox Studio: Roblox Decals

May 14, 2022

Always Stay Up to Date

Subscribe to our newsletter to get our newest articles instantly!

Follow US on Social Media

Facebook Instagram Youtube

© Created and Maintained by the BloxCreators Team
All Rights Reserved 2025

Create your Roblox games to earn Robux with Roblox Studio :)

Contact Us

  • Job@BloxCreators.com
  • Privacy Policy
  • Advertise
  • Subscribe
Welcome Back!

Sign in to your account

Username or Email Address
Password

15 − 6 =

Lost your password?