AlphaWolf536791

Sliding Door

Aug 10th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2. local Door = script.Parent:WaitForChild("SlidingDoor")
  3. local tweeningInfo = TweenInfo.new(
  4.     0.9,
  5.     Enum.EasingStyle.Linear,
  6.     Enum.EasingDirection.Out,
  7.     0,
  8.     false,
  9.     0
  10. )
  11. local doorOpen = {CFrame = CFrame.new(10.5, -4, 7.5)}
  12. local doorClose = {CFrame = CFrame.new(10.5, 4.2, 7.5)}
  13. local tweenOpen = TweenService:Create(Door,tweeningInfo,doorOpen)
  14. local tweenClose = TweenService:Create(Door,tweeningInfo,doorClose)
  15.  
  16. script.Parent.Detector1.Touched:Connect(function(hit)
  17.     tweenOpen:Play()
  18.     wait(3)
  19.     tweenClose:Play()
  20. end)
Add Comment
Please, Sign In to add comment