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

How do you do a 'Part-touch-Part' effect?

Hey guys. I just have one simple question: How would you make a Part do an action when touched by another Part?

For example, let's just say that I have a part named GRASS and another part named MOWER. Whenever the player pushes the part named MOWER and it touches the other part named GRASS, GRASS becomes a different size. In this case, GRASS becomes smaller.

Would the general concept of it go something like this? :

function touch(hit)
	if hit.Name == "MOWER" then
		script.Parent.Size = Vector3.new(1,2,1)
	end
end
script.Parent.Touched:connect(touch)

If anyone could teach me, it would be very, very helpful!

1 answer

✓ Accepted answer

I don't love using the script.Parent kind of thing since I rarely put scripts in the Workspace (since anyone can access them without .FilteringEnabled on). Anyways, That looks pretty much as it should be.

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