• Problems with performing draw.RoundedBox in net.Receive
    2 replies, posted
In my init.lua I'm running this function: util.AddNetworkString("drawBox") function NormalRound() StartCountdown(10, SpecialRound) PrintMessage(HUD_PRINTCONSOLE, "Normal Round Started!") --those 2 lines are unrelated ^^ net.Start("drawBox") net.Broadcast(Entity(1)) end In cl_init.lua I'm receiving it here: net.Receive("drawBox", function() draw.RoundedBox(2, 20, 20, 20, 20, Color(0, 0, 0, 125)) draw.DrawText("Round Thingy", "DermaLarge", 20, 20, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER) print("I received it!") end) It successfully receives the print, as I see "I received it!" in console, but doesn't seem to want to draw anything. Any ideas as to why? Thanks.
You can't use draw functions inside of a net.Receive As the wiki says: https://files.facepunch.com/forum/upload/1348/2427aabf-5a58-402f-b4e7-a11ba052d772/image.png You should create a variable on the client file and set it whenever the client receives the message, and with that variable you should draw the text
Thank you, that fixed my problem.
Sorry, you need to Log In to post a reply to this thread.