• Need help with script error
    13 replies, posted
SOLVED TY VERY MUCH TO ACECOOL :quagmire:
Is this even the full code?
yes it is
According to the error, you have "D Button" somewhere which is a nil value, but in the code, you don't have something like that? So, that obviously can't be it. Look in your whole code for "D Button" and remove the space. It's most likely the issue.
[QUOTE=Author.;45779478]According to the error, you have "D Button" somewhere which is a nil value, but in the code, you don't have something like that? So, that obviously can't be it. Look in your whole code for "D Button" and remove the space. It's most likely the issue.[/QUOTE] you mean this? thats already at the top? [QUOTE]local DButton = vgui.Create( "DButton" ) DButton:SetPos( 0, 32 ) DButton:SetText( "Shit" ) DButton:SetSize( 33, 20 ) DButton.DoClick = function()[/QUOTE]
[QUOTE=Author.;45779478]According to the error, you have "D Button" somewhere which is a nil value, but in the code, you don't have something like that? So, that obviously can't be it. Look in your whole code for "D Button" and remove the space. It's most likely the issue.[/QUOTE] He doesn't, he just wrote in the error manually
Is this in /server? :v Put your clientside in /client, and server in /server.
[QUOTE=Author.;45779611]Is this in /server? :v Put your clientside in /client, and server in /server.[/QUOTE] Or just put it in shared since he has both serverside and clientside code.
[QUOTE=Author.;45779611]Is this in /server? :v Put your clientside in /client, and server in /server.[/QUOTE] tried doing this and got the same error [editline]23rd August 2014[/editline] [QUOTE=code_gs;45779625]Or just put it in shared since he has both serverside and clientside code.[/QUOTE] so put the whole thing in a file called shared... or? sorry im kinda dumb :downs: [editline]23rd August 2014[/editline] i put everything into a file called shared.lua i got the same error though :/ [editline]23rd August 2014[/editline] is anyone there? :suicide:
autorun/client/ -- Client autorun/server/ -- Server autorun/ -- Shared So in other words, your location should be, autorun/poop.lua -- of course you can rename this..
[QUOTE=Author.;45779959]autorun/client/ -- Client autorun/server/ -- Server autorun/ -- Shared So in other words, your location should be, autorun/poop.lua -- of course you can rename this..[/QUOTE] okay so... i put it in autorun. but why does it give me that error and only come up when i edit and save the script?? :pwn:
so nobody can help me get this script working? a shame... :C
Create your button a little later... InitPostEntity or so.. You may be having the issue where the script is loading before either the GMod lua/vgui/ elements are loading ( unlikely ), or before the client has loaded everything. You could even do this: [code]local DButton = nil; hook.Add( "HUDPaint", "InitVGUI", function( ) // This will run a few times while the player is invalid... local _p = LocalPlayer( ); if ( !IsValid( _p ) ) then return; end // Create the dbutton when the player is valid DButton = vgui.Create( "DButton" ); // We only need this to run once after the localplayer exists... hook.Remove( "HUDPaint", "InitVGUI" ); end );[/code]
[QUOTE=Acecool;45784786]Create your button a little later... InitPostEntity or so.. You may be having the issue where the script is loading before either the GMod lua/vgui/ elements are loading ( unlikely ), or before the client has loaded everything. You could even do this: [code]local DButton = nil; hook.Add( "HUDPaint", "InitVGUI", function( ) // This will run a few times while the player is invalid... local _p = LocalPlayer( ); if ( !IsValid( _p ) ) then return; end // Create the dbutton when the player is valid DButton = vgui.Create( "DButton" ); // We only need this to run once after the localplayer exists... hook.Remove( "HUDPaint", "InitVGUI" ); end );[/code][/QUOTE] I love you.
Sorry, you need to Log In to post a reply to this thread.