-------------------------------
--Functions
-------------------------------


function CreateMotor()
	PARENTMODEL.Motors.MotorBlock1.Anchored = false
	
	local motor = Instance.new("Motor")
	motor.Parent = PARENTMODEL.Motors
	motor.Part0, motor.Part1, motor.MaxVelocity = PARENTMODEL.Motors.MotorBlock0, PARENTMODEL.Motors.MotorBlock1, 0.01
end


function WeldToObject(group, obj)
	for _, v in pairs(group) do
		local weld = Instance.new("WeldConstraint")
		weld.Parent, weld.Name = v, "Weld"
		weld.Part0, weld.Part1 = v, obj
		v.Anchored = false
	end
end

function MoveGate()
	if OPEN == false then
		PARENTMODEL.Motors.Motor.DesiredAngle, OPEN = math.rad(-OPENINGANGLE), true
		
	else
		PARENTMODEL.Motors.Motor.DesiredAngle, OPEN = 0, false
	end

end

