Net Message Integer transfer failing to work as intended

Client code and client console print

	net.WriteInt(self.myRole, 4)
	print("myRole DEBUG - ", self.myRole)

myRole DEBUG - 	8

Server code and server console print

net.Receive("RequestAvailableWeapons", function(len, ply)
    local plyRole = net.ReadInt(4)
    local availableWeaponsTable = {}

--More stuff done underneath but cut for length's sake


What’s going on here? How come the number is coming in as 0?

Maybe try increasing the bitcount?

I’ll give it a go, but the highest number self.myRole can ever be is 8. 2^3 is 8. Dunno why it would return 0.

[editline]21st November 2017[/editline]

Oh I see now, it has 8 values, but the first value starts at 0, so it’s 0-7 and not 1-8.