Advertisement
MandB

Codes Gui

Aug 22nd, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. --leaderstats
  2.  
  3. game.Players.PlayerAdded:Connect(function(Player)
  4. local leaderstats = Instance.new("Folder",Player)
  5. leaderstats.Name = "leaderstats"
  6.  
  7. local Cash = Instance.new("NumberValue",leaderstats)
  8. Cash.Name = "Cash"
  9. Cash.Value = 0
  10. end)
  11.  
  12. --CodeServer
  13.  
  14. local RemoteEvent = game.ReplicatedStorage.CodeEvent
  15.  
  16. RemoteEvent.OnServerEvent:Connect(function(Player,Reward,Code)
  17. if Player:FindFirstChild(Code) == nil then
  18. local Redeemed = Instance.new("BoolValue", Player)
  19. Redeemed.Name = Code
  20. Redeemed.Value = false
  21.  
  22. if Redeemed.Value == false then
  23. Player.leaderstats.Cash.Value += Reward
  24. Redeemed.Value = true
  25. end
  26. end
  27. end)
  28.  
  29. --CodeClient
  30.  
  31. local Codes = {"Comment","Like","Subscribe"} --Change to Code names and keep make how much you want
  32.  
  33. local RemoteEvent = game.ReplicatedStorage.CodeEvent
  34.  
  35. script.Parent.EnterButton.MouseButton1Click:Connect(function()
  36. if script.Parent.InputBox.Text == Codes[1] then
  37. RemoteEvent:FireServer("100",Codes[1]) --Price for fist Code
  38. else
  39. if script.Parent.InputBox.Text == Codes[2] then
  40. RemoteEvent:FireServer("200",Codes[2]) --Price for second Code
  41. else
  42. if script.Parent.InputBox.Text == Codes[3] then
  43. RemoteEvent:FireServer(300,Codes[3]) --Price For Third Code
  44. end
  45. end
  46. end
  47. end)
  48.  
  49. --Close Script
  50.  
  51. script.Parent.MouseButton1Click:Connect(function()
  52. script.Parent.Parent.Parent.Frame.Visible = false
  53. end)
  54.  
  55. --OpenScript
  56.  
  57. script.Parent.MouseButton1Click:Connect(function()
  58. script.Parent.Parent.Parent.CodeGui.Frame.Visible = true
  59. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement