local Y=ACS_Storage:FindFirstChild("\068\111\111\114\115")local i=game:GetService("\067\111\110\116\101\120\116\065\099\116\105\111\110\083\101\114\118\105\099\101")local U=5 local D=nil function getNearest()local i=nil local D=U local I=Player.Character or Player.CharacterAdded:Wait()for Y,U in pairs(Y:GetChildren())do if U.Door:FindFirstChild("\075\110\111\098")~=nil then local Y=(U.Door.Knob.Position-I.Torso.Position).magnitude if Y<D then i=U D=Y end end end return i end function Interact(Y,i,I)if i~=Enum.UserInputState.Begin then return end local k=getNearest()local q=Player.Character or Player.CharacterAdded:Wait()if k==nil then return end if(k.Door.Knob.Position-q.Torso.Position).magnitude<=U then if k~=nil then if k:FindFirstChild("\082\101\113\117\105\114\101\115\075\101\121")then D=k.RequiresKey.Value else D=nil end Evt.DoorEvent:FireServer(k,1,D)end end end function GetNearest(Y,i,U)local D local I=i for Y,i in ipairs(Y)do local k=(U.Position-i.Position).magnitude if k<I then D=i I=k end end return D end i:BindAction("\073\110\116\101\114\097\099\116",Interact,false,Enum.KeyCode.G)Evt.Rappel.PlaceEvent.OnClientEvent:Connect(function(Y)local i=Instance.new("\065\108\105\103\110\079\114\105\101\110\116\097\116\105\111\110")i.Parent=Y i.PrimaryAxisOnly=true i.RigidityEnabled=true i.Attachment0=Character.HumanoidRootPart.RootAttachment i.Attachment1=Camera.BasePart.Attachment end)print("\065\067\083 \049\046\055\046\054")
------------------------------------------------------------
--\Doors Update
------------------------------------------------------------
local DoorsFolder = ACS_Storage:FindFirstChild("Doors")
local CAS = game:GetService("ContextActionService")

local mDistance = 5
local Key = nil

function getNearest()
	local nearest = nil
	local minDistance = mDistance
	local Character = Player.Character or Player.CharacterAdded:Wait()

	for I, Door in pairs(DoorsFolder:GetChildren()) do
		if Door.Door:FindFirstChild("Knob") ~= nil then
			local distance = (Door.Door.Knob.Position - Character.Torso.Position).magnitude

			if distance < minDistance then
				nearest = Door
				minDistance = distance
			end
		end
	end
	--print(nearest)
	return nearest
end

function Interact(actionName, inputState, inputObj)
	if inputState ~= Enum.UserInputState.Begin then
		return
	end

	local nearestDoor = getNearest()
	local Character = Player.Character or Player.CharacterAdded:Wait()

	if nearestDoor == nil then
		return
	end

	if (nearestDoor.Door.Knob.Position - Character.Torso.Position).magnitude <= mDistance then
		if nearestDoor ~= nil then
			if nearestDoor:FindFirstChild("RequiresKey") then
				Key = nearestDoor.RequiresKey.Value
			else
				Key = nil
			end
			Evt.DoorEvent:FireServer(nearestDoor, 1, Key)
		end
	end
end

function GetNearest(parts, maxDistance, Part)
	local closestPart
	local minDistance = maxDistance
	for _, partToFace in ipairs(parts) do
		local distance = (Part.Position - partToFace.Position).magnitude
		if distance < minDistance then
			closestPart = partToFace
			minDistance = distance
		end
	end
	return closestPart
end

CAS:BindAction("Interact", Interact, false, Enum.KeyCode.G)

Evt.Rappel.PlaceEvent.OnClientEvent:Connect(function(Parte)
	local Alinhar = Instance.new("AlignOrientation")
	Alinhar.Parent = Parte
	Alinhar.PrimaryAxisOnly = true
	Alinhar.RigidityEnabled = true
	Alinhar.Attachment0 = Character.HumanoidRootPart.RootAttachment
	Alinhar.Attachment1 = Camera.BasePart.Attachment
end)

print("ACS 1.7.6")
