Proximity Door Automatic

I set up a door via Tutorial but edited to close automatically.

the script below lets my door close automatic but when re-triggering the function
again to re open the door, the door still thinks its open…

I tried removing the else and just making function to (open wait close) but removing the else kills the whole script. how would you properly set the function?

proximityprompt.Triggered:Connect(function()
	if debounce == true then
		debounce = false
		if opened.Value == true then
			opened.Value = false

			closeSound:Play()
			tweenService:Create(frame,TweenInfo.new(1.5),{CFrame = frameClose.CFrame}):Play()
		else
			opened.Value = true

			openSound:Play()
			tweenService:Create(frame,TweenInfo.new(1.5),{CFrame = frameOpen.CFrame}):Play()
			
		
		end
		
		wait(2)
		tweenService:Create(frame,TweenInfo.new(1.5),{CFrame = frameClose.CFrame}):Play()
		
		
		wait(.35)
		debounce = true
	end
end)

It’s because after you close it with that last tween you’re not updating opened.Value to false.

1 Like

OHH WOW! so all I would do is put
Opened.Value = false

after the last frame lose

I believe so. Because right now that tween is closing it without telling the BoolValue it’s closed.

1 Like