• Simple Derma Button Math Help
    2 replies, posted
Hi, first post here, i'm pretty new at learning lua and I cannot figure out why this derma button won't preform some basic math, any help would be appreciated! local function CalcMenu() local numnum = 1 local CalcFrame = vgui.Create( "DFrame" ) CalcFrame:SetPos( ScrW() / 2, ScrH() / 2 ) CalcFrame:SetSize( ScrW() / 3, ScrH() / 1.25 ) CalcFrame:ShowCloseButton( false ) CalcFrame:SetDraggable( false ) CalcFrame:ShowCloseButton( false ) CalcFrame:SetVisible( true ) CalcFrame:MakePopup() CalcFrame:Center() local TheButton = vgui.Create( "DButton", CalcFrame ) TheButton:SetText( "Boop" ) TheButton:SetSize( 1, 1 ) TheButton:Dock( FILL ) TheButton.DoClick = function() if numnum <= 1 then numnum = 9 else numnum -= 1 end print(numfac) end end
This isn't valid in Lua; use var = var - 1 instead. Same goes for +=, -- and ++. Make sure you post any errors that you get in the future.
Cool! Ill try it out!
Sorry, you need to Log In to post a reply to this thread.