• net.Send(ply) throwing a NULL error
    4 replies, posted
I kinda feel dumb because I should know why this is happening, and I've been fussing around with it for the past half-hour. So to put it short, I'm trying to network a string to the client, simple enough right!? Here's the snippet of code that's throwing errors: util.AddNetworkString("warTimerToClient") local warCurrent = 1 -- 1 for Calm Time - 2 for Wartime local warTimerCount = 0 local sendInitMSG = 0 timer.Create("war",1200,0, function() if warCurrent == 1 then warCurrent = 2 print("Wartime has started!") elseif warCurrent == 2 then warCurrent = 1 print("Wartime has ended!") end end) timer.Start("war")     local warTimerTimeLeft = timer.TimeLeft("war") net.Start("warTimerToClient") net.WriteString(tostring(warTimerTimeLeft)) net.Send(ply) -- <--- that is line 23 Here's what console says: [ERROR] addons/wartimer/lua/autorun/timer.lua:23: Tried to use a NULL entity! 1. Send - [C]:-1 | 2. unknown - addons/wartimer/lua/autorun/timer.lua:23 I honestly don't know why this is happening. I ran it through an error checker and it came out just fine... (there is more code if you need to see it, this is just the "problem area") Thanks for your help.
Who are you trying to send it to? Because you didn't define ply anywhere..
All players, from what I know just using ply should work :/
`ply` works in that context because it's defined by the callback. Use net.Broadcast to send it to every player.
omg now i feel stupid, Thank you mat!
Sorry, you need to Log In to post a reply to this thread.