Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't this team door script work?

Well, I'm trying to make a team door but this script doesn't seem to work...

script.Parent.Touched:connect(function(part)
	print("Wow")
	local h = part.Parent:FindFirstChild("Humanoid")
	if h == nil then return end
	print("1")
	local char = part.Parent
	local player = game.Players:FindFirstChild(char.Name)
	if player == nil then return end
	print("2")
	if not player.TeamColor == BrickColor.new("Bright red") then
		print("Wow!")
		h.Health = 0
	end
end)

I put in print functions, but Wow, 1 and 2 printed out. The problem is, I was in blue team, and I never got killed. Why?

1 answer

✓ Accepted answer

change the if not player.TeamColor == BrickColor.new("Bright red") then to

if player.TeamColor ~= BrickColor.new("Bright red") then

~if this helped please (up vote) accept :D KIHeros

This discussion is preserved as it was. New answers, comments, and votes are closed.