ULX help needed

I made a code which used to work perfectly fine I recall, I recently added a line of code to broadcast some lua to all players, however I get an error message saying that i am calling a NULL entity?

the snippet:

if invis then
                BroadcastLua(GAMEMODE:AddNotify("Looks like" .. target.Name() .. " needs a spanking!" , NOTIFY_GENERIC, 5)) ---this line is 27
                BroadcastLua( "surface.PlaySound( \"babycry.wav\" )" )

the error message:

[ERROR] addons/ulx-v3_73/lua/ulx/modules/sh/baby.lua:27: Tried to use a NULL entity!
  1. Name - [C]:-1
   2. call - addons/ulx-v3_73/lua/ulx/modules/sh/baby.lua:27
    3. __fn - addons/ulib-v2_63/lua/ulib/shared/commands.lua:943
     4. execute - addons/ulib-v2_63/lua/ulib/shared/commands.lua:1323
      5. unknown - addons/ulib-v2_63/lua/ulib/shared/commands.lua:1351
       6. unknown - lua/includes/modules/concommand.lua:54

what am I doing wrong?

target.Name() should be target:Name() or target.Name(target).

thanks alot didnt notice at all, but now I get this :

[ERROR] addons/ulx-v3_73/lua/ulx/modules/sh/baby.lua:27: attempt to call method 'AddNotify' (a nil value)
  1. call - addons/ulx-v3_73/lua/ulx/modules/sh/baby.lua:27
   2. __fn - addons/ulib-v2_63/lua/ulib/shared/commands.lua:943
    3. execute - addons/ulib-v2_63/lua/ulib/shared/commands.lua:1323
     4. unknown - addons/ulib-v2_63/lua/ulib/shared/commands.lua:1351
      5. unknown - lua/includes/modules/concommand.lua:54

You’re calling it serverside.

It should be

BroadcastLua([[GAMEMODE:AddNotify("Looks like ]] .. target:Nick() .. [[ needs a spanking!" , NOTIFY_GENERIC, 5)]])

FP syntax highlighting needs some work…

thanks alot, it’s working as expected now!