I want to detect if an asset is deleted? Yes. Models, Images, Meshes, Audios, Clothing and more that is a part of an asset.
How can I achieve this?
I want to detect if an asset is deleted? Yes. Models, Images, Meshes, Audios, Clothing and more that is a part of an asset.
How can I achieve this?
I need some clarification, do you mean the Instances that those assets would be used in? Or do you mean like the assets being deleted by Roblox moderation?
For Instances you can use Instance:DecendantRemoving
and then test if the new Parent of the Instance is nil
. The only issue is DecendantRemoving fires before the part has been reparented so you will need to put a delay between when the event fires and you check for the Instance’s new parent.
The assets being deleted by Roblox moderation, yes that’s what I meant for clarification. Sorry I forgot to specify about that.
My best guess, would to use a pcall
. Since if I recall assets that are deleted will cause an error. Not sure in particular what the error says for each asset, but I think you could go by the basis that if an error arises the asset is not currently useable. I would not tell the player it’s been deleted since errors may appear for other reasons.
local success, message = pcall(function()
local asset == --Get your asset here, if it errors the pcall will be given the error to handle it
end)
if not success then --If not success, meaning if their was an error.
warn(message) --Show the error through a warning to not stop the script.
end
If the pcall returns true for success that means the asset should not have had any issues being retrieved and should be useable.
Apparently, it doesn’t work. I tried to add a content deleted audio which says it has been moderated and it didn’t get warn at all, but It does succeed.
You can use the marketplace service and get the name of the product.
I have some clothing that was removed so the names are now:
‘[CONTENT DELETED]’
One of two things could happen:
1 - Fails to get the asset Meaning Its Removed
2 - Gets The Name And If ‘[CONTENT DELETED]’ Then Its Removed
Here Is An Example From My Inventory:
It Was Textured Pants But The Pants Got Removed Due To Copyright.
When Equipped They No Longer Have A Texture.
Here’s The Marketplace Service API:
It doesn’t work for content deleted assets that doesn’t has its name changed so is there also any other way or this is the only way?
If the assetID Still Gets The Object And The Name Hasnt Changed It Means That The Creator Has Removed The Asset Itself But Not Taken It Down.
All this means is that it will appear to have a asset when in reality it has nothing.
For Example If someone Was To Do This With A Mesh, Then The Mesh Would Either Be Invisible Or Not Do Anything.
I’m not currently sure of how to detect this though. Its similar to trying to detect failed union creations, near impossible. But checking the name and if it can get the ID is better than nothing for the meantime.
Yeah you’re right, it is better than nothing in the meantime, so i’m going to leave ur message as a solution. Thanks anyways.
Yes but that isn’t related to detecting it from a script. That is a message from Roblox about action taken against an account for an inappropriate animation.
You cant actually get data on actions taken against an account or a product from a script even if its your own. The only way to view messages like that is at the time of action, and only the creators of the asset may see it.
Even attempting to get access to information that way is not a good idea. It would be considered a breach of privacy and would also be in breach of a few laws also.
It would be wise to write off that idea and never speak of it or try it.