Guest User

Tween Script

a guest
Nov 9th, 2022
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local TweenSpeed = 2
  3. local TweenData = TweenInfo.new(TweenSpeed, Enum.EasingStyle.Linear)
  4. local TweenData2 = TweenInfo.new(2, Enum.EasingStyle.Bounce)
  5.  
  6. local EndPoint = Vector3.new(54, 0.5, 121)
  7. local StartingPoint = script.Parent.Position
  8.  
  9. local XValue = StartingPoint.X + ((StartingPoint.X-EndPoint.X)/2)
  10. local YValue = StartingPoint.Y + ((StartingPoint.Y-EndPoint.Y)/2)
  11. local ZValue = StartingPoint.Z + ((StartingPoint.Z-EndPoint.Z)/2)
  12.  
  13. local MidwayPoint = Vector3.new(XValue,YValue,ZValue)
  14.  
  15. local Goal = {}
  16. Goal.Position = MidwayPoint
  17. local Goal2 = {}
  18. Goal2.Position = EndPoint
  19.  
  20. local Tween1 = TweenService:Create(script.Parent,TweenData,Goal)
  21. local Tween2 = TweenService:Create(script.Parent,TweenData2,Goal2)
  22.  
  23. Tween1:Play()
  24. --realized that when using .Completed it comes to a complete halt before starting the second.
  25. wait(TweenSpeed-0.5)
  26. Tween2:Play()
  27.  
Advertisement
Add Comment
Please, Sign In to add comment