Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does Destroy call crash studio?

Asked by 8 years ago

My studio is crashing whenever I run this script:

bomb = script.Parent

function explode()
    explosion = Instance.new("Explosion", workspace)
    explosion.Position = bomb.Position
    bomb:Destroy()
end

bomb.ClickDetector.MouseClick:connect(explode)

removing the bomb:Destroy() line, it doesn't crash. Trying it with just a touch event instead of mouseclick, it doesn't crash. Any clue why this is happening, and how I might fix it?

0
Where is this script located? Necrorave 560 — 8y
1
This doesn't crash studio on its own. There's nothing wrong with this script. BlueTaslem 18071 — 8y
0
The script is located inside a generic part called Bomb. And alright, I'll try to figure out what exactly is causing the crash. CraftSpider 0 — 8y
0
Got it. Adding any kind of wait between when i set the position and when I destroy the object works. CraftSpider 0 — 8y

Answer this question