Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local part = script.Parent.Parent
  3. local Main = script.Parent.Parent.Part
  4.  
  5. local OtweenInfo = TweenInfo.new(
  6. 2, -- Length of an interpolation
  7. Enum.EasingStyle.Linear, -- Easing Style of the interpolation
  8. Enum.EasingDirection.Out, -- Easing Direction of the interpolation
  9. 0, -- Number of times the sequence will be repeated
  10. false, -- Should the sequence play in reverse as well?
  11. 0 -- Delay between each interpolation (including reverse)
  12. )
  13.  
  14. -- A dictionary of property names, and the values they are trying to reach in the interpolation:
  15. local OpropertyGoals =
  16. {
  17. part:SetPrimaryPartCFrame( Main.CFrame + Vector3.new(-8,0,0))
  18. }
  19.  
  20. -- Create the "Tween" object that represents the playback of this interpolation
  21. local open = TweenService:Create(Main,OtweenInfo,OpropertyGoals)
  22.  
  23. -- Play the interpolation:
  24. --------------------------------------------------------------------------------------------------
  25. --------------------------------------------------------------------------------------------------
  26. local TweenService = game:GetService("TweenService")
  27. local part = script.Parent.Parent
  28. local Main = script.Parent
  29.  
  30. local CtweenInfo = TweenInfo.new(
  31. 2, -- Length of an interpolation
  32. Enum.EasingStyle.Linear, -- Easing Style of the interpolation
  33. Enum.EasingDirection.Out, -- Easing Direction of the interpolation
  34. 0, -- Number of times the sequence will be repeated
  35. false, -- Should the sequence play in reverse as well?
  36. 0 -- Delay between each interpolation (including reverse)
  37. )
  38.  
  39. -- A dictionary of property names, and the values they are trying to reach in the interpolation:
  40. local CpropertyGoals =
  41. {
  42. part:SetPrimaryPartCFrame( Main.CFrame - Vector3.new(0,0,0))
  43. }
  44.  
  45. -- Create the "Tween" object that represents the playback of this interpolation
  46. local Close = TweenService:Create(Main,CtweenInfo,CpropertyGoals)
  47.  
  48. -- Play the interpolation:
  49. Open = false
  50. Moving = false
  51. script.Parent.Parent.Parent.Button.ClickDetector.MouseClick:connect(function()
  52. if Open == false and Moving == false then
  53. Moving = true
  54. Open = true
  55. open:Play()
  56. wait(2)
  57. Moving = false
  58. elseif Open == true and Moving == false then
  59. Moving = true
  60. Open = false
  61. Close:Play()
  62. wait(2)
  63. Moving = false
  64. end
  65. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement