Er1x_Official

Local Script, Code System

Feb 23rd, 2022
1,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.00 KB | None | 0 0
  1. local ui = script.Parent
  2. local frame = ui.Frame
  3.  
  4. local players = game:GetService("Players")
  5. local player = players.LocalPlayer
  6.  
  7. local rep = game:GetService("ReplicatedStorage")
  8. local remote = rep:WaitForChild("RedeemCode")
  9.  
  10. local Redeeming = false
  11.  
  12. frame.Redeem.MouseButton1Click:Connect(function()
  13.     if Redeeming == false then
  14.         Redeeming = true
  15.         task.delay(1.5,function() -- cooldown to not spam codes
  16.             Redeeming = false
  17.         end)
  18.        
  19.         local boolean,message = remote:InvokeServer(frame.Box.Text)
  20.         if boolean ~= nil and message ~= nil then
  21.             frame.Box.Text = message
  22.             if boolean == true then
  23.                 frame.Redeem.TextColor3 = Color3.fromRGB(0, 255, 0)  -- you can remove this, its just a code indicator
  24.             else
  25.                 frame.Redeem.TextColor3 = Color3.fromRGB(255, 0, 0)  -- you can remove this, its just a code indicator
  26.             end
  27.            
  28.             task.delay(.1,function()
  29.                 frame.Redeem.TextColor3 = Color3.fromRGB(255, 255, 255) -- you can remove this, its just a code indicator
  30.             end)
  31.         end
  32.     end
  33. end)
Advertisement
Add Comment
Please, Sign In to add comment