How do I make a team-only door?
I am trying to create a door that only lets one team through and blocks the other team and makes a hint when the wrong team member is trying to get through it.
This is what I have so far:
02 | Defender = BrickColor.new( "Bright green" ) |
03 | Raider = BrickColor.new( "Bright red" ) |
06 | if plr.TeamColor = = Defender then |
07 | door 1. Transparency = 1 |
08 | door 1. CanCollide = false |
10 | door 1. Transparency = 0.5 |
11 | door 1. CanCollide = true |
12 | elseif plr.TeamColor = = Raider then |
13 | door 1. Transparency = 0.5 |
14 | door 1. CanCollide = true |
16 | m = Instance.new( "Hint" ) |
17 | m.Parent = game.Workspace |
18 | m.Text = r.. "Is Trying To Enter The Defender Spawn!" |
24 | door 1. Touched:connect(door) |
I am guessing that "plr" refers to the door instead of the player who touched the door. How do I refer to the player who hit the door in the function?