Advertisement
Arm4GeDon

thatAWESOMEdurScript

Oct 22nd, 2022
1,150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1. local TweenService = game:GetService("TweenService")
  2.  
  3. local door = {}
  4.  
  5. curDoor = game:GetService("ReplicatedStorage"):FindFirstChild("curDoor").Value
  6.  
  7. --I COPY AND PASTED THIS - Zhamp
  8. function door.Open(doorModel, roomModel)
  9.     doorModel:SetAttribute("Open", true)
  10.    
  11.     local ourCustomTween = TweenInfo.new(0.8, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
  12.    
  13.     local cframe = doorModel.Hinge.CFrame * CFrame.Angles(0, math.rad(100), 0)
  14.     local doorTween = TweenService:Create(doorModel.Hinge, ourCustomTween, {CFrame = cframe})
  15.    
  16.     doorTween:Play()
  17.     doorModel.Door.Sound:Play()
  18.    
  19.     curDoor += 1
  20.     print(tostring(curDoor))
  21.    
  22.     wait(0.1)
  23.    
  24.     local doorLight = doorModel.Parent.door_light.light
  25.     local beep = doorModel.Parent.door_light.light.beep
  26.    
  27.     doorLight.BrickColor = BrickColor.new(1, 0, 0)
  28.     beep:Play()
  29.    
  30.     return curDoor
  31. end
  32.  
  33. function door.New(roomModel, number)
  34.     local doorModel = workspace.doors.NewDoorModel:Clone()
  35.    
  36.     doorModel:PivotTo(roomModel.Exit.CFrame)
  37.     doorModel:SetAttribute("Open", false)
  38.    
  39.     if number < 10 then
  40.         number = "000" .. number
  41.     elseif number < 100 then
  42.         number = "00" .. number
  43.     end
  44.    
  45.     doorModel.Sign.SurfaceGui.TextLabel.Text = number
  46.    
  47.     doorModel.Sensor.Touched:Connect(function(hit)
  48.         local humanoid = hit.Parent:FindFirstChild("Humanoid")
  49.         if humanoid and doorModel:GetAttribute("Open") == false then
  50.             door.Open(doorModel)
  51.         end
  52.     end)
  53.    
  54.     doorModel.Parent = roomModel
  55.    
  56.     return doorModel
  57. end
  58.  
  59. return door
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement