Well I wanted team "ct" enter this door. Error says their is no property "Team" in Players. (Ex. Player.Team.TeamColor)
01 | ctdoor = script.Parent |
02 |
03 | function open() |
04 | ctdoor.CanCollide = false |
05 | for transparency = 0 , 1 , . 1 do |
06 | ctdoor.Transparency = transparency |
07 | wait(. 1 ) |
08 | end |
09 | end |
10 |
11 | function close() |
12 | for transparency = 1 , 0 , -. 1 do |
13 | ctdoor.Transparency = transparency |
14 | wait(. 1 ) |
15 | end |
Team is indeed, not a valid member or property of Player. But TeamColor is. You'd access it like so:
1 | player.TeamColor |
But you really should use the IsInGroup function.
01 | group = 1 |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | if hit.Parent:FindFristChild( "Humanoid" ) then |
05 | local player = game.Players:GetPlayerFromCharacter(hit.Parent.Humanoid) |
06 | if player:IsInGroup(group) then |
07 | --do stuff |
08 | end |
09 | end |
10 | end ) |
Hope this helps. I'm tired, but I want to help all that I can; please forgive any of my incoherence.
I like how MINEBLOX106 thinks but here is a better way of doing it.
01 | local group = 1 |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | if hit.Parent:FindFirstChild( 'Humanoid' ) then |
05 | if game.Players:FindFirstChild(hit.Parent.Name) then -- make sure its an actual player not a robot |
06 | if game.Players [ hit.Parent.Name ] :IsInGroup(group) then |
07 | open() |
08 | wait( 4 ) |
09 | close() |
10 | end |
11 | end |
12 | end |
13 | end ) |