Facebook
From GLOKEY.DEV, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 55
  1. local player = game.Players.LocalPlayer
  2. local RE = game.ReplicatedStorage.EnterCode
  3. local codes = player:WaitForChild("Codes")
  4.  
  5. --Optional if you want your code to have an expiration
  6. local date = os.date("*t", os.time())
  7.  
  8. --Codes
  9. local codelist = {
  10.         code1 = "ROBLOX", -- Always put a comma every timne you're going to add another code
  11.         code2 = "Release"
  12. }
  13.  
  14. script.Parent.MouseButton1Click:Connect(function()
  15.         if script.Parent.Parent.CodeHandler.Text == codelist.code1 then -- Im gonna add an expiration in this code
  16.                 if date["month"] <= 8 and date["day"] <= 3 then -- Months are in numerical order .Month and Day must be in lowercase letters. Use "<=" If you want to make your code valid until that date. Use "==" if you want to make your code valid only on that date.
  17.                         if not codes:FindFirstChild("Code1") then -- This one here
  18.                                 RE:FireServer(500, "Code1") -- The string must be the same as in the top. For now I can reward the player, cash. Until I can learn how to save tools.
  19.                                 script.Parent.Text = "Code redeemed successfully!"
  20.                                 script.Parent.Parent.CodeHandler.Text = "" -- Removes the text in our code handler textbox
  21.                                 wait(2)
  22.                                 script.Parent.Text = "Redeem Code"
  23.                         else
  24.                                 script.Parent.Text = "Code already redeemed!"
  25.                                 wait(2)
  26.                                 script.Parent.Text = "Redeem Code"
  27.                         end    
  28.                 else
  29.                         script.Parent.Text = "Code expired!"
  30.                         wait(2)
  31.                         script.Parent.Text = "Redeem Code"             
  32.                 end
  33.         elseif script.Parent.Parent.CodeHandler.Text == codelist.code2 then -- Your second code. So if our textbox matches the code in our dictionary...
  34.                 if not codes:FindFirstChild("Code2") then -- This one here
  35.                         RE:FireServer(25000, "Code2") -- The string must be the same as in the top. For now I can reward the player, cash. Until I can learn how to save tools.
  36.                         script.Parent.Text = "Code redeemed successfully!"
  37.                         script.Parent.Parent.CodeHandler.Text = ""
  38.                         wait(2)
  39.                         script.Parent.Text = "Redeem Code"
  40.                 else
  41.                         script.Parent.Text = "Code already redeemed!"
  42.                         wait(2)
  43.                         script.Parent.Text = "Redeem Code"
  44.                 end
  45.         else
  46.                 script.Parent.Text = "Code invalid!"
  47.                 script.Parent.Parent.CodeHandler.Text = ""
  48.                 wait(2)
  49.                 script.Parent.Text = "Redeem Code"
  50.         end
  51. end)