Hello! I am trying to make an automatic door opening system but the code isnt working. No errors are shown
local tweenservice = game:GetService(“TweenService”)
local db = false
local parent = script.Parent
parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and parent.Parent.Owner.Value ~= “nil” and db == false then
print(hit)
db = true
local properties1 = {
Position = script.Parent.Parent.Door2.Position
}
local properties2 = {
Position = script.Parent.Parent.Door1.Position
}
local tweenfo = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false)
local tween = tweenservice:Create(script.Parent.Parent.Door2, tweenfo, properties1)
tween:Play()
wait(0.2)
wait(3)
local tween2 = tweenservice:Create(script.Parent.Parent.Door2, tweenfo, properties2)
tween2:Play()
wait(0.2)
db = false
end
end)