Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local door = {}
- curDoor = game:GetService("ReplicatedStorage"):FindFirstChild("curDoor").Value
- --I COPY AND PASTED THIS - Zhamp
- function door.Open(doorModel, roomModel)
- doorModel:SetAttribute("Open", true)
- local ourCustomTween = TweenInfo.new(0.8, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0)
- local cframe = doorModel.Hinge.CFrame * CFrame.Angles(0, math.rad(100), 0)
- local doorTween = TweenService:Create(doorModel.Hinge, ourCustomTween, {CFrame = cframe})
- doorTween:Play()
- doorModel.Door.Sound:Play()
- curDoor += 1
- print(tostring(curDoor))
- wait(0.1)
- local doorLight = doorModel.Parent.door_light.light
- local beep = doorModel.Parent.door_light.light.beep
- doorLight.BrickColor = BrickColor.new(1, 0, 0)
- beep:Play()
- return curDoor
- end
- function door.New(roomModel, number)
- local doorModel = workspace.doors.NewDoorModel:Clone()
- doorModel:PivotTo(roomModel.Exit.CFrame)
- doorModel:SetAttribute("Open", false)
- if number < 10 then
- number = "000" .. number
- elseif number < 100 then
- number = "00" .. number
- end
- doorModel.Sign.SurfaceGui.TextLabel.Text = number
- doorModel.Sensor.Touched:Connect(function(hit)
- local humanoid = hit.Parent:FindFirstChild("Humanoid")
- if humanoid and doorModel:GetAttribute("Open") == false then
- door.Open(doorModel)
- end
- end)
- doorModel.Parent = roomModel
- return doorModel
- end
- return door
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement