SHOW:
|
|
- or go back to the newest paste.
| 1 | --If you only have One door instead of Double door, Name the door part "Door1" and this is the script: | |
| 2 | ||
| 3 | local db= false | |
| 4 | local open = script.Parent.Open | |
| 5 | ||
| 6 | script.Parent.Trigger.Touched:connect(function(p) | |
| 7 | if db == false then | |
| 8 | db = true | |
| 9 | - | local f = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0) |
| 9 | + | |
| 10 | - | local f2 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0) |
| 10 | + | |
| 11 | local f1 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0) | |
| 12 | - | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f,i) |
| 12 | + | |
| 13 | - | local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f2,i) |
| 13 | + | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f1,i) |
| 14 | script.Parent.Door1:SetPrimaryPartCFrame(cfm) | |
| 15 | - | script.Parent.Door2:SetPrimaryPartCFrame(cfm2) |
| 15 | + | |
| 16 | end | |
| 17 | open.Value = true | |
| 18 | wait(3) -- how long does the doors open | |
| 19 | local f2 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0) | |
| 20 | - | local f3 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0) |
| 20 | + | |
| 21 | - | local f4 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0) |
| 21 | + | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f2,i) |
| 22 | script.Parent.Door1:SetPrimaryPartCFrame(cfm) | |
| 23 | - | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f3,i) |
| 23 | + | |
| 24 | - | local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f4,i) |
| 24 | + | |
| 25 | open.Value = false | |
| 26 | - | script.Parent.Door2:SetPrimaryPartCFrame(cfm2) |
| 26 | + | |
| 27 | else | |
| 28 | print("User has no card")
| |
| 29 | end | |
| 30 | db=false | |
| 31 | end | |
| 32 | end) | |
| 33 | ||
| 34 | script.Parent.Trigger2.Touched:connect(function(p) | |
| 35 | if db == false then | |
| 36 | db = true | |
| 37 | if p.Parent:FindFirstChild("Card") ~= nil then
| |
| 38 | if open.Value == false then | |
| 39 | local f1 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0) | |
| 40 | for i = 0,1,0.1 do | |
| 41 | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f1,i) | |
| 42 | script.Parent.Door1:SetPrimaryPartCFrame(cfm) | |
| 43 | - | local f = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0) |
| 43 | + | |
| 44 | - | local f2 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0) |
| 44 | + | |
| 45 | open.Value = true | |
| 46 | - | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f,i) |
| 46 | + | |
| 47 | - | local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f2,i) |
| 47 | + | local f2 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0) |
| 48 | for i = 0,1,0.1 do | |
| 49 | - | script.Parent.Door2:SetPrimaryPartCFrame(cfm2) |
| 49 | + | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f2,i) |
| 50 | script.Parent.Door1:SetPrimaryPartCFrame(cfm) | |
| 51 | wait() | |
| 52 | end | |
| 53 | open.Value = false | |
| 54 | - | local f3 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0) |
| 54 | + | |
| 55 | - | local f4 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0) |
| 55 | + | |
| 56 | print("User has no card")
| |
| 57 | - | local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f3,i) |
| 57 | + | |
| 58 | - | local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f4,i) |
| 58 | + | |
| 59 | end | |
| 60 | - | script.Parent.Door2:SetPrimaryPartCFrame(cfm2) |
| 60 | + |