Why does my team only proximity prompt not work?

I’m trying to make a proximity prompt that only appears if a player is in a certain team. I built a hitbox around the proximity prompt and if a player on team blue touches it, the proximity prompt gets visible. If a player on team red touches it, it disappears. The problem is if the player is on blue team it prints “Red”. If a player on red team touches hitbox, it also print “Red”. The color on teams is right, blue = Really blue Red = really red.
here’s the script:

Hitbox.Touched:Connect(function(hit)
	if hit then
		local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
		if player then
			if player.TeamColor == BrickColor.new("Really red") then
				print("Red")
				proximityPrompt.Enabled = false
			elseif player.TeamColor == BrickColor.new("Really blue") then
				print("Blue")
				proximityPrompt.Enabled = true
			
			end
		end
	end
end)
2 Likes

I don’t seem to see anything wrong with the Script itself. Could you perhaps send the Script’s hierarchy in the game’s Explorer tab?

4 Likes

Maybe instead of team color change to team

2 Likes

There’s a part called “Ladderspawner”. In this part is the script. In workspace there’s a part called “Ladderbox” if you touch him the script looks what team the player is

1 Like

Is this in the Workspace?

So there are 2 different parts, with the Script in”Ladderspawner” pointing to the part “Ladderbox”?

2 Likes
  1. Yes both parts are in the workspace.
  2. Also yes

I tried out

if player.Team == "Red"

It didn’t worked and it didn’t printed red or blue.