Advertisement
HowToRoblox

CodesGuiHandler

Jun 23rd, 2021
2,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. local btn = script.Parent.CodesButton
  2.  
  3. local frame = script.Parent.CodesFrame
  4. frame.Visible = false
  5.  
  6.  
  7. btn.MouseButton1Click:Connect(function()
  8.    
  9.     frame.Visible = not frame.Visible
  10. end)
  11.  
  12.  
  13. local lastEntered = ""
  14.  
  15.  
  16. frame.RedeemButton.MouseButton1Click:Connect(function()
  17.    
  18.     game.ReplicatedStorage.CodeEntered:FireServer(frame.InputCode.Text)
  19.    
  20.     lastEntered = frame.InputCode.Text
  21. end)
  22.  
  23.  
  24. game.ReplicatedStorage.CodeEntered.OnClientEvent:Connect(function(msg)
  25.    
  26.    
  27.     if frame.InputCode.Text == lastEntered then
  28.        
  29.         frame.InputCode.Text = msg
  30.     end
  31. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement