Cakey3101

Codes Client

May 23rd, 2025
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | Source Code | 0 0
  1. local Players = game:GetService("Players")
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3.  
  4. local TweenGui = require(script.Parent.TweenGui)
  5.  
  6. local Remotes = ReplicatedStorage.Remotes
  7.  
  8. local Player = Players.LocalPlayer
  9. local PlayerGui = Player.PlayerGui
  10.  
  11. local Gui = PlayerGui:WaitForChild("Codes")
  12. local Frame = Gui.Frame
  13.  
  14. local Exit = Frame.Exit
  15. local Open = PlayerGui:WaitForChild("Main").Right.Codes
  16.  
  17. local Redeem = Frame.Redeem
  18.  
  19. local TextBox = Frame.TextBox
  20.  
  21. local function OnRedeemButtonClick()
  22.     local Text = TextBox.Text
  23.     if TextBox.Text ~= "" then
  24.         Remotes.RedeemCode:FireServer(Text)
  25.     end
  26.    
  27.     TextBox.Text = ""
  28. end
  29.  
  30. Remotes.RedeemCode.OnClientEvent:Connect(function(Success: boolean, Message: string)
  31.     if Success then
  32.         TextBox.Text = Message
  33.         TextBox.TextColor3 = Color3.fromRGB(70, 232, 70)
  34.     else
  35.         TextBox.Text = Message
  36.         TextBox.TextColor3 = Color3.fromRGB(232, 70, 70)
  37.     end
  38.    
  39.     task.delay(2, function()
  40.         TextBox.Text = ""
  41.         TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  42.     end)
  43. end)
  44.  
  45. Open.MouseButton1Click:Connect(function()
  46.     if Gui.Enabled == true then
  47.         TweenGui.CloseGui(Gui, Frame)
  48.     else
  49.         TweenGui.OpenGui(Gui, Frame)
  50.     end
  51. end)
  52.  
  53. Exit.MouseButton1Click:Connect(function()
  54.     TweenGui.CloseGui(Gui, Frame)
  55. end)
  56.  
  57. Redeem.MouseButton1Click:Connect(OnRedeemButtonClick)
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment