Problem with a team detecting door that accepts multiple teams

I have been trying to upgrade a script for a team only door, to instead work as a security door, allowing in multiple types of teams, but if a player is in none of the teams listed, an alarm will be activated.

I cannot make it work with more than one team tho, I am sure there is a way to do it but I am not able to figure it out, here is the beginning of the script:

function onTouched(hit) 
	if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then 
		if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == script.Parent.TeamColor1.Value then

I tried to do something like “script.Parent.TeamColor1.Value or script.Parent.TeamColor2.Value then” but it doesn’t really work, I hope there is a way to make it work without changing the entire code, I scripted over 200 lines of code for this system already.

I am thankful for any help!

function onTouched(hit) 
	if game.Players:GetPlayerFromCharacter(hit.Parent) ~= nil then 
		if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == script.Parent.TeamColor1.Value or game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == script.Parent.TeamColor2.Value then

should work

1 Like