Weird door system behavior

The situation

I’m coding a door system for somebody right now and encountering a bug. The door’s supposed to make a billboard GUI appear with a magnitude check and a beam going from the player to the door. Right now a random door is being broke, I remove that door from the mix and a different one gets broken.

The problem

It’s keeping the line and GUI even if you go away from the door.

The Code

local cas = game:GetService("ContextActionService")
local uis = game:GetService("UserInputService")
local rs = game:GetService("RunService")

local sharedCurrentDoor = nil


rs:BindToRenderStep("doordetectboi",Enum.RenderPriority.Character.Value,function()
	local currentDoor = nil
	if(game.Players.LocalPlayer.Character ~= nil) then
		for i,v in pairs(game.Workspace.Doors:GetChildren()) do
			if((game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.Original.Position).Magnitude < 8) then
				currentDoor = v
				if(currentDoor.Remotes.GetClearance:InvokeServer()) then
					local attachment = Instance.new("Attachment",game.Players.LocalPlayer.Character.UpperTorso)
					currentDoor.Original.Beam.Attachment1 = attachment
					currentDoor.Original.BillboardGui.Enabled = true
					if(uis.GamepadEnabled) then
						currentDoor.Original.BillboardGui.Wrapper.TextLabel.Text = ""
						currentDoor.Original.BillboardGui.Wrapper.TextLabel.XboxButton.Visible = true
					end
					if(uis.TouchEnabled) then
						currentDoor.Original.BillboardGui.Wrapper.TextLabel.Text = "TAP"
						currentDoor.Original.BillboardGui.Wrapper.TextLabel.TextScaled = true
					end
				end
				cas:BindAction("OpenDoor",function(_,state) 
					if(state == Enum.UserInputState.Begin) then
						if(not currentDoor.Remotes.GetCooldown:InvokeServer()) then
							print("Opening a "..currentDoor.Name.." door.")
--							print(currentDoor.Remotes.GetClearance:InvokeServer())
							if(currentDoor.Remotes.GetClearance:InvokeServer() == true) then
								print("Access granted.")
								currentDoor.Remotes.SecureOpen:FireServer()
							else
								print("Access denied.")
								currentDoor.Settings.Sounds.AccessDenied:Play()
							end
						else
							currentDoor.Original.BillboardGui.Wrapper.Interact.Text = "C O O L D O W N"
							currentDoor.Original.BillboardGui.Wrapper.Interact.TextScaled = true
							wait(2)
							if(currentDoor ~= nil) then
								currentDoor.Original.BillboardGui.Wrapper.Interact.Text = "I N T E R A C T"
								currentDoor.Original.BillboardGui.Wrapper.Interact.TextScaled = false
							end
						end
					end
				end,true,Enum.KeyCode.E,Enum.KeyCode.ButtonY)
				cas:SetTitle("OpenDoor","Open")
			else
				if(currentDoor and (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - currentDoor.Original.Position).Magnitude > 8) then
					cas:UnbindAction("OpenDoor")
					currentDoor.Original.BillboardGui.Enabled = false
					currentDoor.Original.Beam.Attachment1 = nil
					game.Players.LocalPlayer.Character.UpperTorso.Attachment:Destroy()
					currentDoor = nil
				end
			end
		end
	end
end)

Thank you for your time.