Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local db= false
- local open = script.Parent.Open
- script.Parent.Trigger.Touched:connect(function(p)
- if db == false then
- db = true
- if p.Parent:FindFirstChild("Card") ~= nil then
- if open.Value == false then
- local f = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
- local f2 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
- for i = 0,1,0.1 do
- local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f,i)
- local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f2,i)
- script.Parent.Door1:SetPrimaryPartCFrame(cfm)
- script.Parent.Door2:SetPrimaryPartCFrame(cfm2)
- wait()
- end
- open.Value = true
- wait(3) -- how long does the doors open
- local f3 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
- local f4 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
- for i = 0,1,0.1 do
- local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f3,i)
- local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f4,i)
- script.Parent.Door1:SetPrimaryPartCFrame(cfm)
- script.Parent.Door2:SetPrimaryPartCFrame(cfm2)
- wait()
- end
- open.Value = false
- end
- else
- print("User has no card")
- end
- db=false
- end
- end)
- script.Parent.Trigger2.Touched:connect(function(p)
- if db == false then
- db = true
- if p.Parent:FindFirstChild("Card") ~= nil then
- if open.Value == false then
- local f = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
- local f2 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
- for i = 0,1,0.1 do
- local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f,i)
- local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f2,i)
- script.Parent.Door1:SetPrimaryPartCFrame(cfm)
- script.Parent.Door2:SetPrimaryPartCFrame(cfm2)
- wait()
- end
- open.Value = true
- wait(3) -- how long does the doors open
- local f3 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
- local f4 = script.Parent.Door2.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
- for i = 0,1,0.1 do
- local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f3,i)
- local cfm2 = script.Parent.Door2.PrimaryPart.CFrame:lerp(f4,i)
- script.Parent.Door1:SetPrimaryPartCFrame(cfm)
- script.Parent.Door2:SetPrimaryPartCFrame(cfm2)
- wait()
- end
- open.Value = false
- end
- else
- print("User has no card")
- end
- db=false
- end
- end)
Add Comment
Please, Sign In to add comment