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?

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