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

How do I Make this Change The Shape of A Specific Brick?

So, I have this script here, that changes the mesh of any brick that touches it. However, I do not know how to make it specific to a certain type of brick. For example, only when a brick called "Tycoon brick" touches it, it only effects that brick; and when bricks like those that are part of characters touch it, it does not change their shape. This is what I have to start, but I don't know how to make it brick specific.

z = script.Mesh 

function onTouched(part) 
z = z:clone() 
z.Parent = part  
end 
script.Parent.Touched:connect(onTouched)

Basically, the mesh is inside of this script, if that helps!

1 answer

✓ Accepted answer

All you have to do is check the name of the part which touched with an if statement.

z = script.Mesh 

function onTouched(part) 
	if part.Name == "Tycoon brick" then
		z = z:Clone() 
		z.Parent = part  
	end
end 
script.Parent.Touched:connect(onTouched)

Hope this helped.

2 comments

0

Yes Thank you!!!

0

No problem.

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