Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Copied blocks won't get destroyed on touch?

Here is my code:

EDIT: Changed the code to this, did not fix it.

function onTouched(hit)
	if hit.Name ~= "Slime" and hit.Name ~= "Baseplate" then
		if hit.Name == "Cannon Shot" then
			script.Parent.ExisHealth.Value = script.Parent.ExisHealth.Value - 1
			hit:remove()
		else
			hit:remove()
		end
	end
end

script.Parent.Touched:Connect(onTouched)

Basically if the slime ball hits a brick, it should destroy it. This works well, except when I copy a brick using a copy tool, or even copying in the Explorer while testing the game. The slime balls simply bounce off the copied brick without doing anything. They still will destroy/remove the original, but none of the copies.

Any suggestions?

2 comments

0

please use :Destroy() instead of :remove() as it is deprecated

0

I did try it with Destroy() and it had the same result, but I will use it from now on.

1 answer

Maybe when you create another part you are forgetting to name it "Cannon Shot"

2 comments

0

It is not supposed to destroy parts named Slime or Baseplate.

0

If the hit name is not Cannon shot, it is supposed to move down to next condition, that destroys it if it is named "Part:

This discussion is preserved as it was. New answers, comments, and votes are closed.