this is a local script
local player = game.Players.LocalPlayer
local RE = game.ReplicatedStorage.EnterCode --EnterCode Is RemoteEvent
local codes = player:WaitForChild("Codes")
local codelist = {
code1 = "ROBLOX", --Test Codes
code2 = "Yeet"
}
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.CodeHandler.Text == codelist.code1
then
if not codes:FindFirstChild ("Code1") then
RE:FireServer(20, "Code1") --Rewards
script.Parent.Text = "Code Redeemed Successfully"
wait(2)
script.Parent.Text = "Redeem Code"
else
script.Parent.Text = "Code Redeemed Successfully"
wait(2)
script.Parent.Text = "Redeem Code"
end
else
script.Parent.Text = "Code Expired"
wait(2)
script.Parent.Text = "Redeem Code"
end
elseif script.Parent.Parent.CodeHandler.Text == codelist.code2 then
if not codes:FindFirstChild ("Code2") then
RE:FireServer(20, "Code2")--Rewards
script.Parent.Text = "Code Redeemed Successfully"
wait(2)
script.Parent.Text = "Redeem Code"
else
script.Parent.Text = "Code Redeemed Successfully"
wait(2)
script.Parent.Text = "Redeem Code"
end
end
end)

3 comments
i cant read the code properly unless you use code block
Have you added codes into the player, when the player joins the game?
I have added codes to the GUI to enter the codes but not to the player