Freamee Posted November 14, 2019 Share Posted November 14, 2019 I have an array with an object, but i want to delete it from another command. But its not working, due invalid function (destroy) let mit = { x: player.position.x, y: player.position.y, z: player.position.z, ent: mp.objects.new(3469410940, new mp.Vector3(player.position), { rotation: new mp.Vector3(0,0,90), alpha: 255, dimension: player.dimension }) } let igen = JSON.stringify(mit); hulla.push(JSON.parse(igen)); hulla.forEach((entity, index) => { if(player.IsInRange(entity.x, entity.y, entity.z, 10)) { result = true; player.pushChat(`törölve: (${index}) ${entity.ent}`); hulla.splice(index, 1); entity.ent.destroy(); } Link to comment Share on other sites More sharing options...
LeonMrBonnie Posted November 14, 2019 Share Posted November 14, 2019 Why are you calling stringify and then parse? Stringify removes all functions of an object. Just push the created object into the array directly. Link to comment Share on other sites More sharing options...
Freamee Posted November 15, 2019 Author Share Posted November 15, 2019 21 hours ago, LeonMrBonnie said: Why are you calling stringify and then parse? Stringify removes all functions of an object. Just push the created object into the array directly. Appreciate your help. :3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now