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 make a one-way door? [SOLVED]

I have a game where you're not supposed to be able to enter the hallway you last entered, and I would like to implement a one-way can-collide brick. Is there any way to do that?

2 answers

Make an invisible brick in front of the entrance that the player walks through to activate the door. Then, have nothing to open the door on the other side. Basically, put no scripts in the door and put it in the invisible brick.

put

door = script.Parent

function onTouch(hit)
	if hit.Parent == nil then return end
	local h = hit.Parent:FindFirstChild("Humanoid")
	if h ~= nil then
		hit.Parent.Torso.Velocity=door.CFrame.lookVector * 10000
	end
end
door.Touched:connect(onTouch)

in door you can change 10000 to the force of the vector

3 comments

0

The door flung me away on either side..

0

Then you reduce the Velocity on line 7

0

Still. The door flung be on either side.. If the door has to be cancollide = false, then this is a very weak door. Players who lag can walk through.

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