SantasGolfClub Posted February 4, 2023 Posted February 4, 2023 I am trying to spawn a group, and then destroy it, so that I am able to spawn it again. I trigger both the Spawn, and then Destroy, from menu items for now, as I learn. My Spawn script file: LostCar = SPAWN:New( "Lost Car" ) :OnSpawnGroup( function( SpawnGroup ) SpawnedLostCar = SpawnGroup.GroupName end ) :Spawn() LostPerson = SPAWN:New( "Lost Person" ) :OnSpawnGroup( function( SpawnGroup ) SpawnedLostPerson = SpawnGroup.GroupName end ) :Spawn() This works. My groups spawns in, and all is great! But when I try destroy, things go bad. Here's my destroy script: DestroyCar = GROUP:FindByName(SpawnedLostCar) DestroyPerson = GROUP:FindByName(SpawnedLostPerson) DestroyCar:Destroy() DestroyPerson:Destroy() Nothing happens. But my log file reveals the error: Quote ERROR SCRIPTING (Main): Mission script error: [string "SpawnedLostCar = GROUP:FindByName(SpawnedLostCar)..."]:5: attempt to index global 'SpawnedLostCar' (a nil value) stack traceback: [C]: ? [string "SpawnedLostCar = GROUP:FindByName(SpawnedLostCar)..."]:5: in main chunk It seems it can't find the SpawnedLostCar group. How can I fix this? AMD Ryzen 7 7700X | 32GB DDR5 | RTX 3080 | Meta Quest 3
HC_Official Posted February 5, 2023 Posted February 5, 2023 to destroy them LostCar:Destroy() LostPerson:Destroy() No more pre-orders Click here for tutorials for using Virpil Hardware and Software Click here for Virpil Flight equipment dimensions and pictures. .
Recommended Posts