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:
door1 = script.Parent
Defender = BrickColor.new("Bright green")
Raider = BrickColor.new("Bright red")
function door(plr)
if plr.TeamColor == Defender then
door1.Transparency = 1
door1.CanCollide = false
wait(2)
door1.Transparency = 0.5
door1.CanCollide = true
elseif plr.TeamColor == Raider then
door1.Transparency = 0.5
door1.CanCollide = true
r = plr.Name
m = Instance.new("Hint")
m.Parent = game.Workspace
m.Text = r.."Is Trying To Enter The Defender Spawn!"
wait(5)
m:remove()
end
end
door1.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?

1 comment
didnt work