Is it possible to UMSG from an entity to the gamemode, or a better way?

So I’m trying to make this game, and there are entities (td_playerstart) which have a key value “mg” which is set to like “1” or so on.
Using ENT:KeyValue, I’m able to see that it’s being added, but when I search for it later, the key isn’t there.
I’ve gotten this far:
[lua]
function etc()
–…
for k, v in pairs( ents.FindByClass( “td_playerstart” ) ) do
table.insert( gamespawns, v )
for i,d in pairs (v:GetKeyValues()) do
print(“FYI:”,i,d)
end
local g = v:GetKeyValues()
print(“Found a spawn for round #” … (g[round]))
end
–…
end
[/lua]
but it isn’t working.
So, How could I get the “mg” to stay? I was thinking maybe networked strings/etc or USMG but that may not be it

try changing print(“Found a spawn for round #” … (g[round])) to print(“Found a spawn for round #” … g.mg)

Yet,

[editline]09:54AM[/editline]

due to
[lua]
function ENT:KeyValue( key, value )
if(key == “round”)then
print(“Found round!”)
–self:SetKeyValue( key, value ) TURNS OUT, THIS’LL ADD A KEYVALUE, AND TRIGGER THIS AGAIN, AND LOOP UNTIL OVERLOADING THE C BUFFER OR SOMETHING
end
end
[/lua]

[editline]10:02AM[/editline]

I think I may have found something thanks to the puzzle gamemode: when the key value gets found, set the entity’s number with SetNumber
[lua]
–from puzzle\entities\entities\checkpoint\shared.lua
//We need to catch the number value
function ENT:KeyValue( key, value )
if ( key == “number” ) then
self:SetNumber( tonumber(value) )
end
if ( key == “title” ) then
self:SetTitle( value )
end
end
[/lua]

[editline]10:05AM[/editline]

also at the top of the file,
[lua]
AccessorFunc( ENT, “CPNumber”, “Number” )
AccessorFunc( ENT, “PuzTitle”, “Title” )
[/lua]
what does it do? I read on the wiki it makes 2 functions (Get(whatever) and Set(whatever)) and it gets/sets a ENT.value

[editline]10:06AM[/editline]

oh wait, it makes SetNumber so that the KeyValue can use it to set it

[editline]10:10AM[/editline]

Oh wow, it works.
I answered my own question thanks to the puzzle gamemode!