Advertisement
Jackthehunter25

Untitled

Dec 6th, 2021
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. local tweenService = game:GetService('TweenService')
  2.  
  3.  
  4. local frames = {
  5. script.Parent:WaitForChild('Top');
  6. script.Parent:WaitForChild('Backgroundscroll');
  7. script.Parent.Backgroundscroll.ScrollingFrame:WaitForChild('Person1');
  8. script.Parent.Backgroundscroll.ScrollingFrame:WaitForChild('Person2');
  9. script.Parent.Backgroundscroll.ScrollingFrame:WaitForChild('Person3')
  10. }
  11.  
  12. local tweens = {}
  13.  
  14. local tweenInfo = TweenInfo.new(0.3)
  15.  
  16. local frame1 = script.Parent.Top
  17. local frame2 = script.Parent.Backgroundscroll
  18. local frame3 = script.Parent.Backgroundscroll.ScrollingFrame.Person1
  19. local frame4 = script.Parent.Backgroundscroll.ScrollingFrame.Person2
  20. local frame5 = script.Parent.Backgroundscroll.ScrollingFrame.Person3
  21.  
  22. tweens = {
  23. [frame1] = {
  24. ['Open'] = tweenService:Create(frame1, tweenInfo, {Size = UDim2.new(5.2, 0,0.5, 0)});
  25. ['Close'] = tweenService:Create(frame1, tweenInfo, {Size = UDim2.new(0,0,0,0)});
  26. ['TimeToWaitBeforeNextFrame'] = 0.3
  27. };
  28. [frame2] = {
  29. ['Open'] = tweenService:Create(frame2, tweenInfo, {Size = UDim2.new(4.98, 0,5.31, 0)});
  30. ['Close'] = tweenService:Create(frame2, tweenInfo, {Size = UDim2.new(0,0,0,0)});
  31. ['TimeToWaitBeforeNextFrame'] = 0.7
  32. };
  33. [frame3] = {
  34. ['Open'] = tweenService:Create(frame3, tweenInfo, {Size = UDim2.new(0.944, 0,0.266, 0)});
  35. ['Close'] = tweenService:Create(frame3, tweenInfo, {Size = UDim2.new(0,0,0,0)});
  36. ['TimeToWaitBeforeNextFrame'] = 0.5
  37. };
  38. [frame4] = {
  39. ['Open'] = tweenService:Create(frame4, tweenInfo, {Size = UDim2.new(0.944, 0,0.266, 0)});
  40. ['Close'] = tweenService:Create(frame4, tweenInfo, {Size = UDim2.new(0,0,0,0)});
  41. ['TimeToWaitBeforeNextFrame'] = 0.5
  42. };
  43. [frame5] = {
  44. ['Open'] = tweenService:Create(frame5, tweenInfo, {Size = UDim2.new(0.944, 0,0.266, 0)});
  45. ['Close'] = tweenService:Create(frame5, tweenInfo, {Size = UDim2.new(0,0,0,0)});
  46. ['TimeToWaitBeforeNextFrame'] = 0.5;
  47. };
  48. };
  49.  
  50. local open = false
  51. script.Parent.Parent:WaitForChild('Open').MouseButton1Click:Connect(function()
  52. open = not open
  53. local tempIsOpen = open
  54. for i,v in ipairs(frames) do
  55. if tempIsOpen ~= open then
  56. return
  57. end
  58. local chosenTween = tweens[v][open and 'Open' or 'Close']
  59. chosenTween:Play()
  60. task.wait(tweens[v].TimeToWaitBeforeNextFrame)
  61. end
  62. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement