This script is meant to check when a player touches the brick, then checks if they are on a certain team, and should kill them. But when testing in game, I get an error on line 7; attempt to index nil with 'TeamColor'
local Players = game:GetService("Players")
local part = script.Parent
local function onTouched(part)
local player = Players:GetPlayerFromCharacter(part.Parent)
if player.TeamColor == "Institutional white" then
player.Character.Humanoid.Health = 0
end
end
part.Touched:Connect(onTouched)
