Yue Posted June 28, 2018 Share Posted June 28, 2018 Script.Vehiculo = nil --entity "Malla Vehiculo" -- Tires local llantas = {} function Script:Start() for indice = 1, self.Vehiculo:CountChildren() do llantas[ indice ] = self.Vehiculo:GetChild( indice ) llantas[ indice ]:Hide() end end The previous scripts in lua close unexpectedly leadwerks. What am I doing wrong? Any suggestions? Quote Link to comment Share on other sites More sharing options...
Solution macklebee Posted June 29, 2018 Solution Share Posted June 29, 2018 I would assume its due to trying to hide an entity that doesn't exist. Start your indice at 0 and decrement the loop's end value by 1. for indice = 0, self.Vehiculo:CountChildren() - 1 do llantas[ indice ] = self.Vehiculo:GetChild( indice ) llantas[ indice ]:Hide() end Also - you should learn to use System:Print() as its a very useful troubleshooting command. Use it to see where your code is failing and what the status of a variable is when the code stops working. It will save yourself some time instead of having to post asking questions on how to troubleshoot your own code. 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Yue Posted June 29, 2018 Author Share Posted June 29, 2018 4 minutes ago, macklebee said: I would assume its due to trying to hide an entity that doesn't exist. Start your indice at 0 and decrement the loop's end value by 1. for indice = 0, self.Vehiculo:CountChildren() - 1 do llantas[ indice ] = self.Vehiculo:GetChild( indice ) llantas[ indice ]:Hide() end Also - you should learn to use System:Print() as its a very useful troubleshooting command. Use it to see where your code is failing and what the status of a variable is when the code stops working. It will save yourself some time instead of having to post asking questions on how to troubleshoot your own code. I appreciate your answer, and I apologize if my questions bother you since I'm a rookie. Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 29, 2018 Share Posted June 29, 2018 6 minutes ago, Yue said: I appreciate your answer, and I apologize if my questions bother you since I'm a rookie. Not a bother - but some of the questions you post could be answered easily by yourself if you learn how to do simple troubleshooting. Think how much farther along you could get in your project if you didn't have to post constantly and wait for someone to tell you the answer, if only you could learn how to start troubleshooting your own code. The link to System:Print() was meant to help you as it appears you are new to programming in general. 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.