how do i make a door that you can go one way through but not the other
If you have a part on the side you want the player to be able to go through, on the floor, then a local script there that makes the can collide feature of the part false on the players side for a set period like 2seconds. That way they can go through but they cannot go back. Something along those lines maybe. If the door opens with a button, maybe the button is only on that side.
add this script to the part:
script.Parent.Touched:Connect(function(Touch)
if Touch.Parent:FindFirstChild("Humanoid") then
task.wait(0.3)
script.Parent.CanCollide = true
end
end)
how would i make it so that you could go through it if you died so bassicly you go through it and you cant go back but then you die and spawn outside of it and can go back through
You can use ProximityPrompts for this, they have a property to disable behind wall interactions, so if you put one in a handle and close the door behind the player, they’ll remain locked in.
Just make two buttons that will make the door open on the entering side and close on the exiting side
If the Player’s Character’s HumanoidRootPart collides with the Part and has a certain Velocity in place (Z-Axis > 0, for example), the Part will become CanCollide false. At 0, the Part will retain its current state, while at the opposite end (Z-Axis < 0, in this case), the Part will become CanCollide true.
Every frame, if the part isn’t CanCollide, quickly set it to collide and find the HumanoidRootPart using GetTouchingParts(), then set its CanCollide based on the velocity.
Not sure how well this would work, considering I’ve never tried it before.
You just broke my brain sir thank you
I think their solution is over complicating something we can easily do with ProximityPrompts, but I can see why they would post that.
its an invisible wall
You can probably use something like Vector3:Dot() to do this. Check what side the player is on, if the player isn’t on the front of the door don’t let them through.
Therefore if the Vector3:Dot() == 1 then they are in front, if Vector3:Dot() < 1 then they are beside or behind.
EDIT: Just tried it, it works.