Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 10 years ago

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

Log in to vote
1
Answered by 10 years ago

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.

Ad

Answer this question