• Ping Script not working properly
    5 replies, posted
[lua] function printpingf() PrintMessage(HUD_PRINTTALK,"Your ping is " .. LocalPlayer():Ping() .. ") end concommand.Add ( "printping", printpingf ) [/lua] Error: [code] autorun/ping.lua:2: attempt to call global 'LocalPlayer' (a nil value) [/code]
You have placed the script in autorun, so it is being called on the server and the client. Move it to autorun/client/
Ugh, now I get [code] autorun/client/ping.lua:2: attempt to call global 'PrintMessage' (a nil value) [/code]
It would probably be better if you made this serverside then and used this: [lua]function printpingf(ply, cmd, args) ply:PrintMessage(HUD_PRINTTALK,"Your ping is " .. ply:Ping()) end concommand.Add ( "printping", printpingf )[/lua]
Haha, I saw this thread coming :v:
Sorry, you need to Log In to post a reply to this thread.