Hello, I just created a sliding door.
I'm having one issue which is the sliding door keeps sliding more if you keep hitting the zone, which then means it doesn't slide back into position properly.
Code is shown below:
script.Parent.Zone.Touched:Connect(function() if not debounce then debounce = true for i,v in pairs(door1:GetChildren()) do tweenServ:Create(door1[v.Name],tweenInfo,{CFrame = CFrame.new(door1[v.Name].Position - Vector3.new(3.6,0,0))}):Play() end wait(2) for i,v in pairs(door1:GetChildren()) do tweenServ:Create(door1[v.Name],tweenInfo,{CFrame = CFrame.new(door1[v.Name].Position + Vector3.new(3.6,0,0))}):Play() end debounce = false end end)
Any suggestions would be appreciated.
Stupid mistake on my end, fixed it myself.
Me being an absolute idiot forgot that a :Play() essentially runs it in the background, therefore the script thinks its complete when really the door never finished closing.
All I had to do was add a wait([time for door to close]) at the end so that it could successfully close.
Thanks to everyone who tried to help!