Hello! So I was making one of those prison roleplay games and I was working on the door system, and for some reason its not working... This is a Server Script inside a trigger part.
CODE:
allowed_teams = { -- List of allowed teams
"Correctional Officers",
"Emergency Response Team",
"Deputy Warden",
"Warden",
"Facility Directors",
"Medical Personnel"
}
door = script.Parent.Parent.Door:GetChildren()
script.Parent.ClickDetector.MouseClick:Connect(function(player)
for a,k in pairs(allowed_teams) do -- Checking if on a valid team from the team table
if player.Team == k then -- If it is a allowed team then...
for i,e in pairs(door) do
if e.ClassName == "Part" then -- Open the door
e.Transparency = 1
script.Parent.CanCollide = false
e.CanCollide = false
else -- Door is already open, close it
e.Transparency = 0
e.CanCollide = true
script.Parent.CanCollide = true
if e.Name == "Window" then
e.Transparency = .5
end
end
end
end
end
end)
Please help, thanks, Blxefirx.
