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

Trying to find out why the error is occuring when trying to find the group thing?

I want to make it to where when a person joins, the server script checks if the player is in one of these roles in the group, and if so, put them in the certain team. I get the error "BrickColor cannot be assigned to" and nothing else. Just curious what I am doing wrong. And yes, this is my first time messing with group roles and IsInGroup, so bare with me.

game.Players.PlayerAdded:connect(function(Plr)
		if Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) >= 253 then
			Plr.TeamColor.BrickColor = BrickColor.new("Black")
		else if
			 Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) < 253 then
			Plr.TeamColor.BrickColor = BrickColor.new("Blue")
		else if
			Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) >=1 <=7  then
			Plr.TeamColor.BrickColor = BrickColor.new("Fossil")
		else if
			Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) <1  then
			Plr.TeamColor.BrickColor = BrickColor.new("Lime Green")
			
		
		
		
		
		
		
		end   
		      end
		end
		
	end
end)

1 answer

#What you did wrong Lua is VERY specific. If you get one tiny thing wrong everything goes wrong. Spell Lime green exactly like how it is in the game, and you can't do Blue you need to do Bright blue. You need to remove BrickColor after TeamColor also. TeamColor is a property. You set TeamColor's value. Not TeamColor.BrickColor.


#Final Product

game.Players.PlayerAdded:connect(function(Plr)
        if Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) <= 253 then
            Plr.TeamColor = BrickColor.new("Black")
        elseif Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) > 253 then
            Plr.TeamColor = BrickColor.Blue() --shortcut
        elseif Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) <=1 >=7  then
            Plr.TeamColor = BrickColor.new("Fossil")
        elseif Plr:IsInGroup(2917029) and Plr:GetRankInGroup(2917029) <1  then
            Plr.TeamColor = BrickColor.new("Lime Green")







        end   
              end
        end

    end
end)


Hope it helps!

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