Script crashes studio, freezes the stop button

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? fire spread

  2. What is the issue? crash

  3. What solutions have you tried so far? none

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Why does my script crash my studio? I want a fire spread!!!

script.Parent.Parent.Touched:Connect(function(hit)
	f = script.Parent:Clone()
	f.Parent = hit
end)
wait(5)
ex = Instance.new("Explosion")
ex.Parent = script.Parent.Parent
ex.Position = script.Parent.Parent.Position
script.Parent.Parent.Color = Color3.new(0,0,0)
script.Parent.Parent:BreakJoints()
script.Parent.Parent.Anchored=false

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Is there anything I can do to prevent it from crashing?

Yes it is because of getting touched multiple times
To prevent it you can add a debounce.
for example
local debounce = false
if debounce == false then
debounce = true
–do what you want
wait(2)–cooldown time
debounce = false
end

1 Like