Why wont this if statement work to block people changing the team of a certain team?

if game.Players[SelectedPlayer].TeamColor ~= ("Shamrock") then
script.Parent.MouseButton1Down:connect(function(p)
	SelectedPlayer = script.Parent.Parent.TextBox.Text
	if game.Players[SelectedPlayer].TeamColor ~= ("Shamrock") then
		game.Players[SelectedPlayer].TeamColor = BrickColor.new(team)
		game.Players.LocalPlayer.PlayerGui.Classification.Enabled = false
	else
		print("cant change officers")
	end
end)

Thank you in advance!

4 comments

0

On line 4, what is "team" in the ()? Also are you getting any errors or are you getting the else print?

0

"team" is "Really black" And I have confirmed I am not getting any errors with the script.

0

Try adding "BrickColor.new" before the "Shamrock" on line 3.

0

Oh my god thank you!!!! It worked! Ive been chasing this all day!