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

How do I do this?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Trying to make a script where if an object named missile touches the brick, both the missile and brick removes.

1missile = workspace:FindFirstChild("Missile")
2 
3function onTouched(hit)
4 
5--I dont know what to do here
6 
7end

Help would be appreciated!

0
Please make your question title relevant to your question content. It should be a one-sentence summary in question form. Thanks! :) AmericanStripes 610 — 10y

1 answer

Log in to vote
1
Answered by
yoshiegg6 176
10 years ago

You don't need to find it in the workspace just find the name of the part that touched it.

1function MissileDetector(hit) --hit argument is the object that touched it
2if hit.Name == "Missile" then --If what touched it's name is missile then
3--Do whatever you want
4end
5end
6 
7script.Parent.Touched:connect(MissileDetector)

Tell me if it works. Don't forget to upvote and accept the answer.

0
correction: if hit.Name == "Missile" then LevelKap 114 — 10y
0
That gets me every time :/ yoshiegg6 176 — 10y
Ad

Answer this question