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

Make a part collidable with certain parts?

How would i be able to make a part collidable with certain parts, but not with others? (Without turning CanCollide to true and false over and over again)

1 comment

0

This is a very good question that I'd like to know the answer to.

1 answer

You may get mad for this, but that's the way.

You can create a part that is originally collidable, and make ones with certain names stop.

Let's give an example.

local name1="ball"
local name2="duck"
function touch(hit)
if hit.Name~=name1 or name2 then
script.Parent.CanCollide=false
wait(.5)
script.Parent.CanCollide=true
else
ex=Instance.new("Explosion")
ex.Parent=game.Workspace
ex.Position=script.Parent.Position
end
end
Script.Parent.Touched:connect(touch)


This will let any part without the name duck or ball through. If not, BOOM!

Hope this helped!

-ds

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