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)