local m=script.Parent.Parent.Door.Sensor while wait()do local U=false for b,F in pairs(game.Players:GetPlayers())do if F.Character and(F.Character:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")and(F.Character.HumanoidRootPart.Position-m.Position).magnitude<10)then U=true break end end if U and not Open then Open=true DoorLogo.Beep:Play()Flash("\066\114\105\103\104\116 \103\114\101\101\110")Move(true)elseif not U and Open then Open=false Move(false)DoorLogo.Beep:Play()Flash("\066\114\105\103\104\116 \114\101\100")end end
-- Detect player within zone and flash parts
local sensor = script.Parent.Parent.Door.Sensor
while wait() do
	local shouldOpen = false
	for _, Player in pairs(game.Players:GetPlayers()) do
		if
			Player.Character
			and Player.Character:FindFirstChild("HumanoidRootPart")
			and (Player.Character.HumanoidRootPart.Position - sensor.Position).magnitude < 10
		then
			shouldOpen = true
			break
		end
	end
	-- Flash parts
	if shouldOpen and not Open then
		Open = true
		DoorLogo.Beep:Play()
		Flash("Bright green")
		Move(true)
	elseif not shouldOpen and Open then
		Open = false
		Move(false)
		DoorLogo.Beep:Play()
		Flash("Bright red")
	end
end
