Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local door = script.Parent.Parent
- local hinge = script.Parent.Doorframe.Hinge
- local room = script.Parent.Parent.Parent
- local light = room.door_light.light
- local beep = room.door_light.light.beep
- local hitbox = door.Door.hitbox
- local openSound = door.Door.Base.Sound
- local goalOpen = {}
- goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)
- local goalClose = {}
- goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)
- local tweenInfo = TweenInfo.new(1)
- local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
- local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)
- local opened = false
- local function openDoor()
- if opened == false then
- tweenOpen:Play()
- openSound:Play()
- opened = true
- wait(0.2)
- light.Color = Color3.new(1, 0, 0.0156863)
- beep:Play()
- end
- end
- hitbox.Touched:Connect(openDoor)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement