--[[ 
strings-override
Theta Technologies 2021
eFlex Next Generation
It's all at the door...
]]


local doorvalue = script.Parent.Parent.Parent.Outputs.DoorOpen

function MoveDoor(angle)
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(2.5 , Enum.EasingStyle.Sine , Enum.EasingDirection.InOut)
	local tween = tweenservice:Create(script.Parent.Door.Hinge.HingeConstraint , tweeninfo , {TargetAngle = angle})
	tween:Play()
end

doorvalue.Changed:Connect(function(newdoorvalue)
	wait(0.5)
	if script.Parent.Parent.Parent.Outputs.DoorOpen.Value == false then
		MoveDoor(0)
		return
	end
	if newdoorvalue then
		MoveDoor(90)
	else
		MoveDoor(0)
	end
end)
