Making a plugin fire a function when a model is imported

How would a plugin see when a model is imported from the toolbox?

1 Like

Umm. Can you explain more, I don’t really understand the question?

Is it possible for a plugin to fire a event when the user gets a model from the toolbox?

Well, I cannot find any official way of doing this. But, you could connect game.DecendantAdded to a function, but you cannot check to see if it is from the toolbox that way. There might be a more effective way of doing this. Why do you need to know when a model is loaded through the toolbox? There may be a different way of doing this depending on what you are trying to do.

2 Likes

Im making a virus scanner plugin and I want to see models from the toolbox because it is faster then scanning the entire game

Ok, then you could use game.DecendantAdded it would scan it whenever something is added to the game. The only problem is that if I were to make a part it would scan through that part. I think it would also scan through things if you change it’s parent. I don’t know if there is a way to see when something is loaded through the toolbox. I will do some searching to see if there is a way… :smiley:

1 Like

Ok, I will set yours as the solution, if you can find anything else please tell me!

Ok, I would not set mine as the solution yet because someone more experienced than me might know more. There are not many people on at this time so you could wait till later to see if more experienced might know more. :smiley:

1 Like

Ok, thanks for the help anyways!

1 Like

No problem!!! :smiley: (It is screaming at me that I need at least 30 characters so here we go… :smile:)

1 Like

If there was any way to do this, it’d be under the InsertService. No such method exists though. Plugins cannot check when users insert items from the toolbox. The toolbox itself is ported in Lua and you could instead listen to functions called to insert tools, though those are all internal and inaccessible.