Advertisement
PeaPattern

ls 2

Apr 17th, 2024
591
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.50 KB | None | 0 0
  1. local TService = game:GetService("TweenService")
  2. local RStorage = game:GetService("ReplicatedStorage")
  3. local SService = game:GetService("SoundService")
  4. local Players  = game:GetService("Players")
  5.  
  6. local LocalPlayer = Players.LocalPlayer
  7.  
  8. local Remotes = RStorage.Remotes
  9. local Modules = RStorage.Modules
  10.  
  11. local UI = script.Parent
  12. local RebirthMenu = UI.RebirthMenu
  13. local CodeMenu = UI.CodeMenu
  14. local Bottom = UI.Bottom
  15. local Click = Bottom.Click
  16. local Rebirth = Bottom.Rebirth
  17. local StatFrame = UI.Stats
  18. local Clicks = StatFrame.Clicks
  19. local Rebirths = StatFrame.Rebirths
  20. local ClickLabel = Clicks.Label
  21. local RebirthLabel = Rebirths.Label
  22.  
  23. function newInfo(Time)
  24.     return TweenInfo.new(Time, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
  25. end
  26.  
  27. function Notify(Text, Color)
  28.     local Template = script.Template:Clone()
  29.     Template.Parent = UI
  30.     Template.Position = UDim2.new(math.random(2, 8) / 10, 0, math.random(3, 6) / 10, 0)
  31.     Template.TextColor3 = Color or Template.TextColor3
  32.     Template.Text = Text
  33.    
  34.     local Tween = TService:Create(Template, TweenInfo.new(1), {
  35.         TextTransparency = 1,
  36.         Position = Template.Position + UDim2.new(0, 0, -0.1, 0)
  37.     })
  38.     Tween:Play()
  39.    
  40.     local Connection
  41.     Connection = Tween.Completed:Connect(function()
  42.         Connection:Disconnect()
  43.         Template:Destroy()
  44.     end)
  45. end
  46.  
  47. function Play(sfx)
  48.     local new = sfx:Clone()
  49.     new.Parent = SService
  50.     new:Destroy()
  51. end
  52.  
  53. function ApplyButton(obj, callback)
  54.     local isHovering = false
  55.     local oldSize = obj.Size
  56.     local oldColor = obj.BackgroundColor3
  57.    
  58.     local INF, INF2 = newInfo(0.3), newInfo(0.2)
  59.     local MB1D_TWEEN = TService:Create(obj, INF2, {
  60.         Size = UDim2.new(oldSize.X.Scale * 0.85, 0, oldSize.Y.Scale * 0.85, 0),
  61.         BackgroundColor3 = Color3.new(oldColor.R * 0.8, oldColor.G * 0.8, oldColor.B * 0.8)
  62.     })
  63.     local HOVER = TService:Create(obj, INF, {
  64.         Size = UDim2.new(oldSize.X.Scale * 1.1, 0, oldSize.Y.Scale * 1.1, 0),
  65.         BackgroundColor3 = Color3.new(oldColor.R * 0.9, oldColor.G * 0.9, oldColor.B * 0.9)
  66.     })
  67.     local RESET = TService:Create(obj, INF, {
  68.         Size = oldSize,
  69.         BackgroundColor3 = oldColor
  70.     })
  71.    
  72.     obj.MouseButton1Down:Connect(function()
  73.         MB1D_TWEEN:Play()
  74.         Play(script.click)
  75.         callback()
  76.     end)
  77.  
  78.     obj.MouseButton1Up:Connect(function()
  79.         if isHovering then
  80.             HOVER:Play()
  81.         else
  82.             RESET:Play()
  83.         end
  84.         Play(script.unclick)
  85.     end)
  86.  
  87.     obj.MouseEnter:Connect(function()
  88.         HOVER:Play()
  89.         isHovering = true
  90.         Play(script.hover)
  91.     end)
  92.  
  93.     obj.MouseLeave:Connect(function()
  94.         RESET:Play()
  95.         isHovering = false
  96.         Play(script.unhover)
  97.     end)
  98. end
  99.  
  100. local RebirthsValue = LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Rebirths")
  101. local ClicksValue = LocalPlayer:WaitForChild("leaderstats"):WaitForChild("Clicks")
  102.  
  103. RebirthLabel.Text = RebirthsValue.Value
  104. RebirthsValue.Changed:Connect(function()
  105.     RebirthLabel.Text = RebirthsValue.Value
  106. end)
  107.  
  108. ClickLabel.Text = ClicksValue.Value
  109. ClicksValue.Changed:Connect(function()
  110.     ClickLabel.Text = ClicksValue.Value
  111.     RebirthMenu.Requirements.Label.Text = ("%d Clicks"):format((RebirthsValue.Value + 1) * 100)
  112. end)
  113.  
  114. ApplyButton(Click, function()
  115.     Remotes.Click:FireServer()
  116.     Notify(("+%d Clicks"):format(RebirthsValue.Value + 1))
  117. end)
  118.  
  119. ApplyButton(Rebirth, function()
  120.     RebirthMenu.Visible = not RebirthMenu.Visible
  121. end)
  122.  
  123. ApplyButton(RebirthMenu.Close, function()
  124.     RebirthMenu.Visible = false
  125. end)
  126.  
  127. ApplyButton(RebirthMenu.Confirm, function()
  128.     if ClicksValue.Value >= (RebirthsValue.Value + 1) * 100 then
  129.         Remotes.Rebirth:FireServer()
  130.         Notify("+1 Rebirths", Color3.fromRGB(255, 129, 211))
  131.         Play(script.rebirth)
  132.     else
  133.         Notify("NEED MORE CLICKS", Color3.fromRGB(255, 0, 0))
  134.         Play(script.error)
  135.     end
  136. end)
  137.  
  138. ApplyButton(StatFrame.Codes, function()
  139.     CodeMenu.Visible = not CodeMenu.Visible
  140. end)
  141.  
  142. ApplyButton(CodeMenu.Close, function()
  143.     CodeMenu.Visible = false
  144. end)
  145.  
  146. local Codes = require(Modules.Codes)
  147.  
  148. ApplyButton(CodeMenu.Confirm, function()
  149.     local TypedCode = CodeMenu.CodeBox.Text
  150.    
  151.     local Found = false
  152.     for code, callback in Codes do
  153.         if code == TypedCode:lower() then
  154.             Found = true
  155.             break
  156.         end
  157.     end
  158.    
  159.     if Found then
  160.         local Result = Remotes.Code:InvokeServer(TypedCode)
  161.         if Result == 0 then
  162.             Notify("INVALID CODE", Color3.fromRGB(255, 0, 0))
  163.             Play(script.error)
  164.         elseif Result == 1 then
  165.             Notify("ALREADY USED CODE", Color3.fromRGB(255, 0, 0))
  166.             Play(script.error)
  167.         elseif Result == 2 then
  168.             Notify("CODE SUCCESS", Color3.fromRGB(0, 255, 0))
  169.             Play(script.code)
  170.         end
  171.     else
  172.         Play(script.error)
  173.     end
  174. end)
  175.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement