How do you make a one way door so it can only be opened from one side? I made a one way door that pushes players n a certain direction, but it is a bit faulty.
COMMUNITY QUESTION
How to make a 1 Way Door?
1 answer
door = script.Parent
function open()
door.Transparency = 0.5
door.Anchored = true
door.CanCollide = false
end
function close()
door.Transparency = 0
door.Anchored = false
door.CanCollide = true
end
reloading = false
function touched(hit) if hit~= nil then if hit.Parent~= nil then if game.Players:FindFirstChild(hit.Parent.Name)~= nil then if hit.Parent:FindFirstChild("Torso")~= nil then
look = hit.Parent:FindFirstChild("Torso").Velocity.unit*10
look2 = hit.Parent:FindFirstChild("Torso").CFrame.lookVector*10
pt = (door.CFrame*CFrame.new(0, 0, -200000)).p -- waaay ahead in front
dooroff = door.Position-look
dooroff2 = door.Position-look2
if ((pt-dooroff).magnitude<(pt-door.Position).magnitude and (pt - dooroff2).magnitude<(pt-door.Position).magnitude) then
if reloading == false then
open()
reloading = true
wait(1)
close()
reloading = false
end
else
close() -- cant get past even if door is open!
end
end end end end end
door.Touched:connect(touched)
If the door is touched from one part it becomes can collide, if it's from another nothing happens.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Nothing happens, I put the script into the part with the name door, is there anything else I need to do?
I don't know.