Using keyvalues?

I’m in the process of making a DM gamemode, and I’m currently trying to assign the spawnpoints to a team. I’ve tried setting a “team” keyvalue on my info_player_start ents, but when i try to get the ents in a lua scripts by doing ents.FindByClass(“info_player_start”), i get nothing. Because of that, i can’t retreive the keyvalues, so that part remains untested. How would i get this working? Am i using the wrong spawn ent?

Thanks in advance!

Post I made from another thread like this:
You could put an entity in there that has no real use in Hammer, but when the map is run with the script, the script recognizes that special useless entity and makes it where that entity has a purpose in the game. Example
info_player_team1 - custom spawnpoint for team 1, no coding involved. Will show as obsolete in Hammer.
info_player_team2 - custom spawnpoint for team 2, no coding involved. Will show as obsolete in Hammer.
When the script is run on the map, if the script has something in there to recognize info_player_team1 or team2, if you chose your team, for example, which would be team1, you would spawn at the info_player_team1 place. If your friend joined and picked team 2, the script would send him on his merry way to info_player_team2.
I hope that helped.