Question about SetViewEntity in Net Library

Hello, I’ve created a system for properties and am trying to use this to view them:



if SERVER then
	util.AddNetworkString("viewdatshit")
	net.Receive( "viewdatshit", function( len, ply )
		local num = tonumber(net.ReadString())
		print(num)
		ply:SetViewEntity(CAMERA_POSITION[num])
	end )
end


and this is what is sent to the client when they press the button:



        net.Start("viewdatshit")
		net.WriteString(PropertyID)
	net.SendToServer()


When the client presses the button, the console prints the num which is 1 but does not use the SetViewEntity.
When I replace with ply:SetViewEntity(CAMERA_POSITION[num]) with ply:SetViewEntity(CAMERA_POSITION[1]) it works perfectly fine.

Is there any reason why this might not work?
Thanks <3<3

What does num print as?

it returns as 1.

edit: I also tried using notification.AddLegacy instead of print with:



--NotePlayer is something I have as a replacement for notification.AddLegacy
ply:NotePlayer("dis is it yo " ..num)


which still gives me “dis is it yo 1”

edit2: So it seems if I just use ply:SetViewEntity(CAMERA_POSITION[1]) and then add the ply:NotePlayer(tonumber(net.ReadString())) above it it doesn’t work, no errors etc.
Even after removing it it still doesn’t want to work anymore.

it’s because you’re sending the number as a string instead of an int