I have a script in a part and when a player on a certain team touches it, the part CanCollide goes false.
local door = script.Parent
door.Touched:Connect(function(Door)
local character = Door.Parent:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character)
if character then
if player.Team == game:GetService('Teams').TEAMNAME then
door.CanCollide = false
else
--SCRIPT HERE
end
end
end)
However when a player on that certain team tries to touch the door, it ends with an error in the output attempting to index nil with 'Team' at line 7. How do I make it so this script does what I want?
