I am looking for just a basic part, that when there are 0 players on the bright blue team, that part goes away/turns transparency = 1 and cancollide = false or simply is nil
transparency = 1 cancollide = false
or
script.Parent = nil
First, you would need to check how many players there are on that team. To do this, we'll get a table of all the players, then go through and check the teams of all of them:
local BluePlayers=0 function GetAmountOnBlue() BluePlayers=0 local Players=game.Players:GetChildren() for _,Player in pairs(Players) do if Player.TeamColor==BrickColor.new("Bright blue") then BluePlayers=BluePlayers+1 end end end while script.Parent do GetAmountOnBlue() end
Now, this would work to constantly update the amount of players on the blue team.
However we still need to change the brick. To do that, we'll add in this bit of code:
if BluePlayers==0 then script.Parent.Transparency=1 script.Parent.CanCollide=false else script.Parent.Transparency=0 script.Parent.CanCollide=true end
This would check if there is any players on the 'Bright blue' team, and if there isn't, it will "open" the door.
Now that that's done, let's put the entire code together:
local BluePlayers=0 function GetAmountOnBlue() BluePlayers=0 local Players=game.Players:GetChildren() for _,Player in pairs(Players) do if Player.TeamColor==BrickColor.new("Bright blue") then BluePlayers=BluePlayers+1 end end end while script.Parent do wait() GetAmountOnBlue() if BluePlayers==0 then script.Parent.Transparency=1 script.Parent.CanCollide=false else script.Parent.Transparency=0 script.Parent.CanCollide=true end end
So, I believe this should work now how you wanted.
Anyways, if you have any further questions/problems, please leave a comment below. Hope I helped :P