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

Can't make this brick destroy another brick if they touch?

script.Parent.Touched:connect(function(m)
	if m.name == "Sand" then
		m:Destroy()
	end
end)

I have put this script inside of a part, and basically it's function is that if the brick "Sand" touches it, that "Sand" brick gets destroyed. However it does not seem to be working even after I've tried to mess around with it, and the developer console gives me no feedback on any errors. Could anyone help me understand the problem?

4 comments

0

CAPITALS m.Name :P

0

Also capital C for Connect but technically it'll still work without it

0

i have never seen anyone use a capital C for connect

0

^ Probably because the scripts you see are old/people are just used to :connect more. It’s recommended to use :Connect() as :connect() is deprecated.

1 answer

Put this script into the brick that destroys the other brick:

script.Parent.Touched:connect(function(hit) if hit.Parent.Name == "NameOfTheBrickThatYouWantToDestroy" then game.Workspace.NameOfTheBrickThatYouWantToDestroy:Destroy()

I hope this helps.

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