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

How do I do this?

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

missile = workspace:FindFirstChild("Missile")

function onTouched(hit)

--I dont know what to do here

end

Help would be appreciated!

1 comment

0

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

1 answer

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

function MissileDetector(hit) --hit argument is the object that touched it
if hit.Name == "Missile" then --If what touched it's name is missile then
--Do whatever you want
end
end

script.Parent.Touched:connect(MissileDetector)

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

2 comments

0

correction: if hit.Name == "Missile" then

0

That gets me every time :/

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