:Destroy() not working?

I’m following the tutorial series of videos ROBLOX made a couple years ago and I followed their exact code to try and replicate what they’re doing. However, in the process of this I encountered that what the tutorial put in no longer works.

At 0:33 he creates a script for the bomb that causes it to explode after it has been created. However, when my bomb explodes it does not get deleted afterward. I checked for typos and errors multiple times and found nothing. Did ROBLOX change and deleting a part isn’t like this anymore?

local explosionPart = script.Parent
local explosion = Instance.new(“Explosion”)
explosion.Parent = game.Workspace
explosion.Position = explosionPart.Position

There’s the script that goes inside of the bomb part.

local explosionPart = game.Workspace.pipebomb
local function createExplosionPartCopy()
local explosionPartCopy = explosionPart:Clone()
explosionPartCopy.Parent = game.Workspace
while true do

Here’s the script that goes inside ServerScriptStorage. Instead of the location of the part being inside ServerStorage, I just left it in the Workspace. I changed the lines referencing it’s location to match it being in the Workspace.

It’s a really basic and new question, and you could probably tell that I am new to scripting, so I would like for you to help me out. Thanks

1 Like

Make sure to post your script as well, No one will be able to help without seeing what you have in your script.

The code present in that video should work just fine, you may have just forgotten to call a function or something along the lines of that.

I edited the post to add my scripts.

Use codeblocks to make your code easier to read by adding ``` before and after your code

what is “explosion()” suppose to do? Because unless you have something that is not posted there. You are trying to call a variable as a function???

I may be mistaken, and the Documentation for class ‘Explosion’ is currently down so I can not double check, but doesn’t the explosion get fired automatically? Meaning calling the function explosion() [Line 6] would just result in an error?

Edit: I am aware I posted “Documentary” instead of “Documentation” above, ignore that. I haven’t had much sleep in the past few days.

Yes, they do get called automatically. I’ve never even see explosion() and I know it is not a function of the explosion. Delete that line and it should be good. @VOKZ3L

Ah yes, I forgot to mention that I added that line “explosion().”

It’s not included in the tutorial, but if I don’t have it there, when I run the game it only creates 2 explosion and then stops exploding. For some reason if I add that line it creates an infinite amount like it should, but it still doesn’t get deleted.

Mind posting an .rbxl file to the place so we can get a better idea of the workflow throughout the file?

1 Like

sdasaf.rbxl (33.8 KB)

sdasaf.rbxl (33.9 KB)
Your issue was to do with the fact that you were using a reference part that was later being destroyed
I have fixed this by moving ‘pipebomb’ to ServerStorage, and cloning it to workspace for each explosion.

If this resolves all the issues present, please make sure to set this post as the Solution so other people do not come in here trying to help, just to see it is already solved.

You fixed my issues. Thank you for the help.

No problem, but as stated above make sure you set the post as the solution.

Is there some checkbox to make it say solved, or do I just edit the title?

There should be a faded checkmark on all posts (On the bottom bar of the post ,where you typically have options like Replying, liking, sharing, etc.) if you click it on the post that solved the issue then it will mark it as the solution.

like this for example:image
Clicking the Checkmark on the far left will mark it as the solution

Alright, I figured it out. Again, thank you for the help.