My team only gate isnt working. I want team Terra Cotta to be able to walk through the gate and team Toothpaste to not be able to. Once team Terra Cotta touches the gate, team Toothpaste can walk through it. I dont want that.

local gate = script.Parent

local Players = game:GetService("Players")

local debounce = false 

gate.Touched:Connect(function(hit)
	if not debounce then
		debounce = true
		if hit then
			local player = Players:GetPlayerFromCharacter(hit.Parent)
			if player and player.TeamColor == BrickColor.new("Terra Cotta") then
			gate.CanCollide = false 
			end
		end
		debounce = false
	end
end)