I am trying to create an automatic sliding door that opens whenever the player touches a detector part.
The function isn’t working at all, it doesn’t even print the “touch” part.
I have looked at numerous tutorials and my script is literally the same as them and yet it doesn’t work for me.
local TweenService = game:GetService("TweenService")
local left = script.Parent.leftd
local right = script.Parent.rightd
local t1 = script.Parent.touch1
local tweenInfo = TweenInfo.new{
3,
Enum.EasingStyle.Linear
}
local leftopen = {}
leftopen.CFrame = left.CFrame * CFrame.new(10,0,0)
local leftopentween = TweenService:Create(left, tweenInfo, leftopen)
local leftclose = {}
leftclose.CFrame = left.CFrame
local leftclosetween = TweenService:Create(left, tweenInfo, leftclose)
local rightopen = {}
rightopen.CFrame = right.CFrame * CFrame.new(10,0,0)
local rightopentween = TweenService:Create(right, tweenInfo, rightopen)
local rightclose = {}
rightclose.CFrame = rightclose.CFrame
local rightclosetween = TweenService:Create(right, tweenInfo, rightclose)
script.Parent.touch1.Touched:Connect(function(hit)
print("touch")
leftopentween:Play()
rightopentween:Play()
wait(6)
leftclosetween:Play()
rightclosetween:Play()
end)