Just untick the 'CanCollide' property in the properties of the part.
It should look a little like this for an open/close door
01 | local Door = script.Parent --The Part that we are touching |
02 | function onTouch(Brick) --Sends a message to the brick that it was touched |
03 | local Player = Brick.Parent:findFirstChild( "Humanoid" ) --Searches for a human |
04 | if (Player ~ = nil ) then --If there is a human then.. |
05 | Door.CanCollide = false --Door opens |
06 | Door.Transparency = 1 Door is see through |
07 | Door.BrickColor = BrickColor.new(math.random(), math.random(), math.random()) --Changes colour, just a little fun thing if you want it |
08 | wait( 1.5 ) --Waits 1 1/2 seconds before it closes |
09 | Door.CanCollide = true --closes |
10 | Door.Transparency = 0 --Door is normal again |
11 | end |
12 | end |
13 | Door.Touched:connect(onTouch) --Connects to the onTouch script. |
Put this in a script in the part.
1 | while true do |
2 | script.Parent.CanCollide = false |
3 | wait( 10 ) -- So it doesn't crash |
4 | end |
Locked by User#2
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?