I have some server side code in my init.lua that works except for one line which does not error and wont work unless I refresh the lua after the initial load.
local cam = ents.FindByName("skycam") function GM:PlayerInitialSpawn( ply ) ply:SetTeam( 1 ) -- Assign players to Team 1 (unauthenticated) until they log in and are authenticated into the appropriate team. ply:SetModel( "models/player/kleiner.mdl" ) -- Set a model otherwise players are just a black.... thing. umsg.Start("logintest") umsg.End() ply:SetViewEntity( cam ) end function GM:PlayerSpawn( ply ) ply:SetupHands() ply:Give("weapon_fists") ply:SetViewEntity( ply ) ply:SetPos(Vector(-992,816,-2516)) ply:SetEyeAngles(Angle(0,90,0)) end
The code ply:SetViewEntity doesn’t fire until a lua refresh. I need this to work flawlessly without a refresh. Any suggestions as to what is happening and why?