GroupId = 2886609
function checkOkToClick(name)
if game.Players[name]:IsInGroup(GroupId) == true then return true end
return false
end
script.Parent.MouseClick:Connect(function(PlrWhoClicked)
local human = PlrWhoClicked.Character.Humanoid.Parent:findFirstChild("Humanoid")
if (checkOkToClick(human.Parent.Name)) then
Door1 = script.Parent.Parent.Parent.LGate:GetChildren()
for i,q in pairs(Door1) do
if v:IsA("BasePart") then
q.Transparency = 1
v.CanCollide = false
wait(3)
v.Transparency = 0
v.CanCollide = true
end
Door2 = script.Parent.Parent.Parent.RGate:GetChildren()
end
for i,v in pairs(Door2) do
if v:IsA("BasePart") then
v.Transparency = 1
v.CanCollide = false
wait(3)
v.Transparency = 0
v.CanCollide = true
Door1OPEN = script.Parent.Parent.Parent.RGateOpen:GetChildren()
for i,v in pairs(Door1OPEN) do
if v:IsA("BasePart") then
v.Transparency = 1
v.CanCollide = false
wait(3)
v.Transparency = 0
v.CanCollide = true
Door2OPEN = script.Parent.Parent.Parent.LGateOpen:GetChildren()
for i,v in pairs(Door2OPEN) do
if v:IsA("BasePart") then
v.Transparency = 1
v.CanCollide = false
wait(3)
v.Transparency = 0
v.CanCollide = true
end
end
end
end
end
end
I am unsure why this fails to work.

5 comments
It's meant so only group members can click it
Where is the script located?
Inside the click detector, modeled up with the model
You should tab your code correctly.
Ok, I can't give you a solid answer because of just how you're going about opening and closing the doors. I'd have to rewrite your whole script in order for the opening and closing to be smooth. But, the code breaking errors were your end statement placements, and on line 10 "Connect" needed to be "connect". You can figure out the rest: http://pastebin.com/cH32qFWb