• Cant find ply? help
    6 replies, posted
local frame = vgui.Create("DFrame") frame:SetSize(1000,720) frame:Center() frame:SetVisible(true) frame:MakePopup() function buttonPressed() print("The button was pressed!") ply:SetHealth( 200 ) end local button = vgui.Create("DButton", frame) button:SetPos(10,50) button:SetSize(200,45) button:SetText("SetHealth") button.DoClick = buttonPressed its in singleplayer lua_openscript_cl i get "attempt to index global 'ply' (a nil value)"
Change ply to LocalPlayer() and make buttonPressed a local function.
Does not set my health? Do i need to run this on the server instead?
Yeah, you need to network it.
Derma won't work on serverside. You'll need to network. Use net.SendToServer and net.Receive
Please use local or anonymous functions for callbacks.
And the first argument passed for the Receive callback is the message length.
Sorry, you need to Log In to post a reply to this thread.