Advertisement
saturnsolar

Tweening Door that opens in 5 minutes | ROBLOX

Apr 16th, 2020
4,018
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. local tweenservice = game:GetService("TweenService")
  2. local doorleft = script.Parent:WaitForChild("DoorLeft")
  3. local doorright = script.Parent:WaitForChild("DoorRight")
  4.  
  5. local function tween(target,direction,style,seconds,position)
  6.     local tween = tweenservice:Create(target,TweenInfo.new(seconds,style,direction),{Position = position})
  7.     tween:Play()
  8. end
  9.  
  10. while true do
  11.     wait(5) -- duration of how long the door will stay closed
  12.     tween(doorleft,Enum.EasingDirection.Out,Enum.EasingStyle.Bounce,1,doorleft.Position + Vector3.new(-3.4,0))
  13.     tween(doorright,Enum.EasingDirection.Out,Enum.EasingStyle.Bounce,1,doorright.Position + Vector3.new(3.4,0))
  14.     wait(1) --wait for the door animation to finish first
  15.     wait(2) --duration of how long the door will stay open
  16.     tween(doorleft,Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,1,doorleft.Position - Vector3.new(-3.4,0))
  17.     tween(doorright,Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,1,doorright.Position - Vector3.new(3.4,0))
  18.     wait(1) -- wait for the door animation to finish first
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement