Advertisement
FlyingFrog

TweenDoor

Apr 10th, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local part = script.Parent.Parent
  3. local startCoordinates = part.Position
  4. local newPosition = Vector3.new(-14.178, 5.154, -7.71)
  5. local isOpen = false
  6.  
  7. local tweenInfo = TweenInfo.new(
  8. 1.5,
  9. Enum.EasingStyle.Linear,
  10. Enum.EasingDirection.Out,
  11. 0,
  12. false,
  13. 0
  14. )
  15.  
  16. script.Parent.Triggered:Connect(function()
  17. local tween
  18. if isOpen == true then
  19. local properties = {
  20. ["Position"] = startCoordinates
  21. }
  22. tween = TweenService:Create(part,tweenInfo, properties)
  23. else
  24. local properties = {
  25. ["Position"] = newPosition
  26. }
  27. tween = TweenService:Create(part,tweenInfo, properties)
  28. end
  29.  
  30. tween:Play()
  31.  
  32. tween.Completed:Connect(function()
  33. isOpen = not isOpen
  34. end)
  35. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement