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?
wait(1)
local explosionPart = script.Parent
local explosion = Instance.new(“Explosion”)
explosion.Parent = game.Workspace
explosion.Position = explosionPart.Position
explosion()
wait(1)
explosionPart:Destroy()
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
end
while true do
createExplosionPartCopy()
wait(1)
end
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
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.
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.
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:
Clicking the Checkmark on the far left will mark it as the solution