Problem with detectors

So I made a sliding door, but the detectors that detect if the player touched them wont let the player go through. I need a way to make it so that the player can go through the detector but still be detected as touching the detectors.
Code:

local TweenService = game:GetService(“TweenService”)
local DoorLeft = script.Parent.DoorLeft
local DoorRight = script.Parent.DoorRight
local TweeningInformation = TweenInfo.new(
0.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local DoorLeftOpen = {CFrame = CFrame.new(15.875, 7, 37.625)}
local DoorLeftClosed = {CFrame = CFrame.new(20.625, 7, 37.625)}
local DoorRightOpen = {CFrame = CFrame.new(30.875, 7, 37.625)}
local DoorRightClosed = {CFrame = CFrame.new(26.375, 7, 37.625)}
local TweenLeftOpen = TweenService:Create(DoorLeft, TweeningInformation, DoorLeftOpen)
local TweenRightOpen = TweenService:Create(DoorRight, TweeningInformation, DoorRightOpen)
local TweenLeftClosed = TweenService:Create(DoorLeft, TweeningInformation, DoorLeftClosed)
local TweenRightClosed = TweenService:Create(DoorRight, TweeningInformation, DoorRightClosed)

The below code is the code you need to see.
script.Parent.DetecterFront.Touched:Connect(function(hit)
TweenLeftOpen:Play()
TweenRightOpen:Play()
wait(2)
TweenLeftClosed:Play()
TweenRightClosed:play()
end)
script.Parent.DetecterBack.Touched:Connect(function(hit)
TweenLeftOpen:Play()
TweenRightOpen:Play()
wait(2)
TweenLeftClosed:Play()
TweenRightClosed:play()
end)

Not sure I understand your problem here, are you saying you want the door to only tween once to avoid spam?

No. The player can’t go through the detectors.

Hi again! :slight_smile:

Did you disable collisions to that detector part?

image

Have you tried

DoorLeft.CanCollide = false
DoorRight.CanCollide = false

?

I tried to do that but when I did it would not detect the player touching it.

Are you sure everything is working properly? Does the output say anything? What about prints?

Nope. Everything should be working.

I don’t see any checks in your script that avoid the tween from restarting making the door technically loop its position endlessly.

Ok so I fixed the problem with the player not going through the detectors, but now the detectors delete themselves without me putting that in the code.


What changes did you apply to your script?

The detector doesn’t appear to be anchored, ensure that the detectors are anchored.