It errors out at line 6 when using the hit parameter to identify hit.Parent's name. The parent is a tool with a brick in it. This is not a local script
local a = script.Parent.Parent
local Door1 = a.Door1
local Door2 = a.Door2
script.Active.Value = false
function open(hit)
if hit.Parent.Name == "SecurityKey1" or hit.Parent.Name == "SecurityKey2" or hit.Parent.Name == "SecurityKey3" then
if script.Active.Value == false then
script.Active.Value = true
script.Parent.Parent.Button2.Script.Active.Value = true
script.Parent.Open:Play()
script.Parent.Parent.Button2.BrickColor = BrickColor.new("Really red")
script.Parent.Parent.Button.BrickColor = BrickColor.new("Really red")
for i = 1,40 do
Door1.CFrame = Door1.CFrame - Vector3.new(.4,0,0)
Door2.CFrame = Door2.CFrame + Vector3.new(.4,0,0)
wait(.01)
end
wait(4)
script.Parent.Close:Play()
for i = 1,40 do
Door1.CFrame = Door1.CFrame + Vector3.new(.4,0,0)
Door2.CFrame = Door2.CFrame - Vector3.new(.4,0,0)
wait(.01)
end
script.Parent.Parent.Button2.BrickColor = BrickColor.new("Lime green")
script.Parent.Parent.Button.BrickColor = BrickColor.new("Lime green")
wait(3)
script.Active.Value = false
script.Parent.Parent.Trigger.Script.Active.Value = false
end
end
end
script.Parent.Touched:connect(open)
