Advertisement
Anukun_Lucifer

TweenScript

Aug 8th, 2024
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.35 KB | Gaming | 0 0
  1. -- ประกาศการใช้ TweenService
  2. local TweenService = game:GetService("TweenService")
  3.  
  4. -- หา Part ที่เราต้องการจะ Tween
  5. local part = script.Parent
  6.  
  7. -- กำหนดค่าเป้าหมาย (goal) ที่ต้องการให้ Part เปลี่ยนแปลง
  8. local goal = {}
  9. goal.Position = Vector3.new(131.059, 4.775, 15.742)
  10.  
  11. -- กำหนดการตั้งค่าของ Tween
  12. local tweenInfo = TweenInfo.new(
  13.     8,                          -- เวลาที่ใช้ในการ Tween (วินาที)
  14.     Enum.EasingStyle.Sine,      -- รูปแบบการเคลื่อนไหว (EasingStyle)
  15.     Enum.EasingDirection.InOut,   -- ทิศทางการเคลื่อนไหว (EasingDirection)
  16.     -1,                          -- จำนวนครั้งที่ต้องการให้ Tween วนซ้ำ (0 = ไม่วนซ้ำ)
  17.     true,                      -- กำหนดว่า Tween ควรย้อนกลับหรือไม่ (reverse)
  18.     0                           -- เวลาหน่วงก่อน Tween เริ่ม (วินาที)
  19. )
  20.  
  21. -- สร้าง Tween
  22. local tween = TweenService:Create(part, tweenInfo, goal)
  23.  
  24. -- เริ่มการ Tween
  25. tween:Play()
  26.  
Tags: Roblox tween
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement