Noti_fied

Untitled

May 17th, 2021 (edited)
1,334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.55 KB | None | 0 0
  1. --// Services
  2.  
  3. local TweenService = game:GetService("TweenService")
  4.  
  5.  
  6. --// Variables
  7.  
  8. local Player = game.Players.LocalPlayer
  9.  
  10. local Main = workspace.DoublePhysicsDoor.Frame.Main
  11.  
  12. local Frame = Player.PlayerGui:WaitForChild("LockpickingUI").Frame
  13. local MainFrame = Frame.MainFrame
  14. local Button = MainFrame.Button
  15. local Line = MainFrame.Line
  16.  
  17. local Debounce
  18.  
  19.  
  20. --// Connections
  21.  
  22. Main.ProximityPrompt.Triggered:Connect(function()
  23.     if Debounce then return end
  24.     Debounce = true
  25.     Frame.Visible = true
  26.  
  27.     local Connection
  28.     local ShouldTweensRun = true
  29.  
  30.     coroutine.wrap(function()
  31.         local RandomNumber = math.random(4,8)
  32.  
  33.         for i = 1, RandomNumber do
  34.             local TimeForTween = Random.new():NextNumber(1,1.5)
  35.  
  36.             local _TweenInfo = TweenInfo.new(TimeForTween, Enum.EasingStyle.Linear)
  37.             local TweenUp = TweenService:Create(Line, _TweenInfo, {Position = UDim2.new(0.012,0,0, 0)})
  38.             local TweenDown = TweenService:Create(Line, _TweenInfo, {Position = UDim2.new(0.012,0,0.989, 0)})
  39.  
  40.             ShouldTweensRun = true
  41.  
  42.             Connection = Button.MouseButton1Click:Connect(function()
  43.                 local ButtonPosY = Button.Position.Y.Scale
  44.                 local LinePosY = Line.Position.Y.Scale
  45.  
  46.                 if LinePosY <= ButtonPosY + Button.Size.Y.Scale and LinePosY >= ButtonPosY then
  47.                     ShouldTweensRun = false
  48.  
  49.                     Connection:Disconnect()
  50.                 else
  51.                     ShouldTweensRun = false
  52.                     Frame.Visible = false
  53.                     Debounce = false
  54.  
  55.                     Connection:Disconnect()
  56.                 end
  57.             end)
  58.  
  59.             while ShouldTweensRun do
  60.                 TweenUp:Play()
  61.                 wait(TimeForTween)
  62.  
  63.                 TweenDown:Play()
  64.                 wait(TimeForTween)
  65.             end
  66.  
  67.             if not Frame.Visible then
  68.                 break
  69.             end
  70.         end
  71.  
  72.         if Frame.Visible then
  73.             game.ReplicatedStorage.LockpickingEvent:FireServer()
  74.  
  75.             Frame.Visible = false
  76.             Debounce = false
  77.         end
  78.     end)
  79.  
  80.     while Frame.Visible do
  81.         wait(.5)
  82.  
  83.         local Character = Player.Character or Player.CharactedAdded:Wait()
  84.  
  85.         if (Character.HumanoidRootPart.Position - Main.Position).Magnitude > 15 then
  86.             Connection:Disconnect()
  87.             ShouldTweensRun = false
  88.             Debounce = false
  89.             Frame.Visible = false
  90.         end
  91.     end
  92. end)
  93.  
Add Comment
Please, Sign In to add comment