Guest User

Untitled

a guest
Mar 29th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.57 KB | None | 0 0
  1. game.ReplicatedStorage.DoorManage.OnServerEvent:Connect(function(player, door)
  2.         if not door.Cooldown.Value then
  3.             door.Cooldown.Value = true
  4.     if door.Name == "DoubleSlidingDoor" then
  5.         if door.Open.Value and not door.Lockdown.Value then
  6.        
  7.         door.Interactive.DoorOpen:Play()
  8.         door.Interactive.Granted:Play()
  9.         local info = TweenInfo.new(4)
  10.         local goal = {}
  11.         goal.CFrame = door.Door1.CFrame + door.Door1.CFrame.LookVector * 6
  12.        
  13.         local tween1 = game:GetService("TweenService"):Create(door.Door1, info, goal)
  14.        
  15.         local info = TweenInfo.new(4)
  16.         local goal = {}
  17.         goal.CFrame = door.Door2.CFrame + door.Door2.CFrame.LookVector * -6
  18.        
  19.         local tween2 = game:GetService("TweenService"):Create(door.Door2, info, goal)
  20.         tween1:Play()
  21.         tween2:Play()
  22.         door.Open.Value = false
  23.         tween1.Completed:Connect(function()
  24.             door.Cooldown.Value = false
  25.         end)
  26.     elseif not door.Open.Value and not door.Lockdown.Value then
  27.        
  28.         door.Interactive.DoorClose:Play()
  29.         door.Interactive.Granted:Play()
  30.         local info = TweenInfo.new(4)
  31.         local goal = {}
  32.         goal.CFrame = door.Door1.CFrame + door.Door1.CFrame.LookVector * -6
  33.        
  34.         local tween1 = game:GetService("TweenService"):Create(door.Door1, info, goal)
  35.        
  36.         local info = TweenInfo.new(4)
  37.         local goal = {}
  38.         goal.CFrame = door.Door2.CFrame + door.Door2.CFrame.LookVector * 6
  39.        
  40.         local tween2 = game:GetService("TweenService"):Create(door.Door2, info, goal)
  41.         tween1:Play()
  42.         tween2:Play()
  43.         door.Open.Value = true
  44.         tween1.Completed:Connect(function()
  45.             door.Cooldown.Value = false
  46.         end)
  47.     end
  48.        end
  49. end)
Advertisement
Add Comment
Please, Sign In to add comment