For my error, it’s with this code. But the value I want to have is the value of the slider in a label when the value change.
[lua]function startframe() // the frame it will be set in.
local SizeNX = CreateClientConVar( “C_SizeX”, “0”, false, false)
local GetSizeX = SizeNX:GetFloat()
local DermaPanel = vgui.Create( “DFrame” ) – Creates the frame itself
DermaPanel:SetSize( 210, 315 ) – Size of the frame ( use half the width / height of your screen )
DermaPanel:SetPos( 300, 100 )
DermaPanel:SetTitle( “Testing Derma Stuff” ) – Title of the frame
DermaPanel:GetDraggable( )
DermaPanel:GetSizable( )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) – Draggable by mouse?
DermaPanel:ShowCloseButton( true ) – Show the close button?
DermaPanel:MakePopup( ) – Show the frame
DermaPanel.Paint = function()
draw.RoundedBox( 2, 0, 0, DermaPanel:GetWide() , DermaPanel:GetTall(), Color( 100, 100, 100, 255 ) ) end
local NumSliderX = vgui.Create( “DNumSlider”, DermaPanel )
NumSliderX:SetPos( 25,50 )
NumSliderX:SetWide( 150 )
NumSliderX:SetText( fValue )
NumSliderX:SetMin( 0 ) – Minimum number of the slider
NumSliderX:SetMax( 512 ) – Maximum number of the slider
NumSliderX:SetDecimals( 0 ) – Sets a decimal. Zero means it’s a whole number
NumSliderX:SetConVar( “C_SizeX” ) – Set the convar
local NumSlider = vgui.Create( “DNumSlider”, DermaPanel )
NumSlider:SetPos( 25,50 )
NumSlider:SetWide( 150 )
NumSlider:SetText( “Max Props” )
NumSlider:SetMin( 0 ) – Minimum number of the slider
NumSlider:SetMax( 256 ) – Maximum number of the slider
NumSlider:SetDecimals( 0 ) – Sets a decimal. Zero means it’s a whole number
NumSlider:SetConVar( “sbox_maxprops” ) – Set the convar
NumSlider.ValueChanged = function(pSelf, fValue)
print("Max prop changed to: "…fValue)
end
end
concommand.Add(“MyTestPanel”,startframe,startframe)[/lua]
autorun\client est.lua:21: attempt to concatenate global 'fValue' (a nil value)
Running script autorun\client est.lua...
vgui/DNumSlider.lua:96: bad argument #1 to 'SetText' (string expected, got nil)