• Help with Lua Error
    2 replies, posted
Well I have been working on bringing GoFish back to life for a few days now. Everything was going fine until this error came up. Not sure how to work with it. Yes I am a novice coder when it comes to LUA so dont use big words that might frighten me:) The error that the script is creating is [CODE] [ERROR] gamemodes/fish/gamemode/spawnmenu/prop_spawn.lua:29: attempt to call field 'Create' (a nil value) 1. Init - gamemodes/fish/gamemode/spawnmenu/prop_spawn.lua:29 2. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153 3. Init - gamemodes/fish/gamemode/cl_panels.lua:51 4. Create - lua/includes/extensions/client/panel/scriptedpanels.lua:153 5. Call - gamemodes/fish/gamemode/cl_panels.lua:23 6. unknown - gamemodes/base/gamemode/cl_spawnmenu.lua:66 7. unknown - lua/includes/modules/concommand.lua:69 [/CODE] The code found at that location [CODE]for k,v in pairs( FISH) do local ent = ents.Create("prop_physics") ent:SetAngles(Angle(0,0,0)) ent:SetPos(Vector(0,0,0)) ent:SetModel(k) ent:Spawn() ent:Activate() ent:PhysicsInit( SOLID_VPHYSICS ) local ico = vgui.Create( "DModelPanel", self ) ico:SetModel(k) ico.Skin = math.random(0,util.GetModelInfo(k).SkinCount-1) ico.Entity:SetSkin(ico.Skin) ico.DoClick = function( ico ) RunConsoleCommand("ProcessCommand"..v.NAME) surface.PlaySound( "ui/buttonclick.wav" ) end ico:SetSize(55,55) local center = ent:OBBCenter() local dist = ent:BoundingRadius()*v.VIEW ico:SetToolTip( Format( "%s", v.DESCRIPTION.." - Cost: $"..v.PRICE ) ) ico:SetLookAt( center ) ico:SetCamPos( center+Vector(dist,dist,dist) ) ico:InvalidateLayout( true ) if v.GROUP then self.IconList[v.GROUP]:AddItem( ico ) end ent:Remove() end end[/CODE] Any help would be greatly appreciated. If it is easier feel free to add me on steam and we can talk it up on there. Thank you! [highlight](User was banned for this post ("utt" - garry))[/highlight]
It looks like this is called on the Client Side, ents.Create can no longer be called on Client in GM13.
[QUOTE=Lerpaderp;39994570]It looks like this is called on the Client Side, ents.Create can no longer be called on Client in GM13.[/QUOTE] How would I fix this then? Would I add a [CODE] if SERVER then[/CODE]? A small example or extended detail would be appreciated EDIT: OK I got it working. I am just experiencing a bizarre error now with the spawn menu...
Sorry, you need to Log In to post a reply to this thread.